I’m not a doctor. If your doctor says your life is in danger, and there is no chance of delivering the baby in time, then you shouldn’t feel bad because you were forced to choose between one death or two deaths.
I would also suggest you turn to any family members or your church family for support in this difficult time. Many women have miscarriages, and they can be very supportive.
I hope everything turns out okay for you and your baby, and I’ll be praying for you.