Part of that was the recognition that, even if she had committed the worst crimes, the potential infant would be innocent at birth (except of course for Original Sin) and deserved to try to live long enough to be baptized. So a pregnant murderess wouldn't be executed, for instance, until after the birth.
And it was normal for a midwife to be called to assist.
In non-criminal situations the mother's life was generally given precedence over the fetus's in a crisis. Partly because she could have more, partly because she was more likely to survive long-term if the intervention succeeded.