One may provide the mother whatever medical care is appropriate for her health provided the care is not directly intended to end the pregnancy. One may do good even though an evil does result. One may not do evil even if a good may result.
Thus, the mother may be treated. If the treatment results in the death of the baby, that is regrettable but not sinful. If the treatment is to kill the baby, that is not just regrettable but sinful as well.
Please note that the mother may be treated. She is not required to give consent to treatment. "Greater love than this no man hath, that a man lay down his life for his friends."