Is it muttar to set aside the rules of shabbos to save a fetus? If so, how is it possible to reconcile that with the permissibility of killing a fetus (abortion)?
The Gemara says that if a pregnant woman is desperately craving food, she can eat it even on Yom Kippur if needed. The Rishonim there discuss that this is firstly out of concern for her own safety; furthermore, if not having this food may harm the fetus, it's a lot riskier to the mother to deliver a stillborn than it is a live baby. But beyond that, the Rishonim imply that saving the "proto-life" of the fetus is still enough to violate Yom Kippur (and hence shabbos). Certainly if the fetus is at 40 or more days post-conception, and possibly even earlier.
Even if we view the fetus as not "fully alive yet", we have the concept of "violate one shabbos to save a life, so that more shabboses will be kept"; thus, we have a potential life here, which is enough to warrant breaking shabbos or yom kippur.
Rabbi EY Waldenburg (Tzitz Eliezer) discusses this question; his ruling is brought down by Rabbi Dr. Abraham Steinberg in Hilchos Rofi'm uRefuah (Mossad Harav Kook, 1978), 2:1:17:
כאשר יסוד ההיתר לחילול שבת הוא משום הסברא של "חלל עליו שבת אחת כדי שישמור שבתות הרבה" -- כגון בעובר, יש מקום לומר שאז מותר חילול שבת רק במקרים של ודאי פקוח נפש ולא בספק פקוח נפש.
When the basis for the allowance of desecrating Shabbos is because of "Desecrate one Shabbos, so that he can keep many Shabbosos" (usually it's because of וחי בהם, but there are exceptions -- Shokhet) -- for example, with a fetus; there is room to say that one is only allowed to desecrate Shabbos for cases of certain danger to life, and not in cases of uncertain danger to life.
He cites Tzitz Eliezer 8:15:7:1-9 and 9:17:2:22 as the sources for this ruling, as well as many more in the footnote to that halacha.