This is not the case. Even if the foetus is a human person, body autonomy tells us that no person should be forced to give up their own bodily well being in ensure the survival of someone else.
Let's say that a person needs a kidney or they will day, would it be OK to force the only compatible donor to donate his because he can survive without it? If not, how is it fine to force a woman to go through nine months of pregnancy? Pregnancy and birth can be harmful to the body, and even put the mother's life at risk.
It's common to say that the "pro-life vs. pro-choice" debate is all about whether the foetus is a person of not, but that's a misdirect. You can resolve that question and still find yourself trying to solve essentially the trolley problem.