The baby has a zero chance of survival. The surgery will save the mother's life. If medical technology were advanced enough to allow transplanting the baby from its pathological location, and placing it into the uterus, then most ethicists would say this should be done. Since this is not possible with present technology, the tiny new baby's life today is lost. The same applies.
Surgery is done or treatment is given to prevent the death of the mother.
The death of the baby, if it occurs, would be an unfortunate and undesired secondary effect. If at all possible, the baby should also be saved. This was the result of one morning's work in a Canadian teaching hospital. In times past, abortion took the life of one, for other-wise two would die. Today, abortion takes the life of one, where otherwise two would live.