Ectopic pregnancy?
The Church has agreed that in the case of ectopic pregnancy, the baby has no chance to be born alive in any case. The primary purpose of operating in the case of ectopic pregnancy is to save the mother’s life, and the death of the baby, although regretable, is a side effect, not the central aim of the operation.
That may sound a bit complicated, but I think it makes sense.
It’s basically different from the usual “life or health” of the mother excuses, which basically amount to abortion on demand.