the baby or the mother??

Happens all the time.

If fetus is at age too young to sustain life on its own, its seen if its possible to treat mother till fetus is viable, if not abortion is carried out and mother is saved.

If fetus is old enough to have a chance to live, fetus is delivered immedately, and tranferred to intensive care.

As a general rule (there may be some exceptions), you cant save the fetus without saving the mother.