א"ר נחמן אמר שמואל האשה שישבה על המשבר ומתה בשבת מביאין סכין ומקרעים את כריסה ומוציאין את הוולד
Rabbi Nachman said in the name of Shmuel: If a pregnant woman in labor died on Shabbat, we bring a knife, incise the abdomen and deliver the child.
A Modern case of post mortem Cesarean Sections
A post mortem cesarean section is (mercifully) vanishingly rare. One review published in 1971 claimed that at the time there were fewer than 150 cases with infant survival reported in the world literature.
But it does happen. A recent case report from Turkey is pretty typical of the sort of things that gets published in medical journals. A 29 year old woman who was 31 weeks pregnant suffered massive head and chest injuries in a car accident. She stopped breathing in the ambulance and CPR was started, which continued in the emergency department. An emergency cesarean section was performed “15 minutes after arrest” and a baby girl was delivered. The baby required breathing support and had some bleeding complications, but was discharged after a month in the hospital and remained healthy with no neurological or physical problems. Alas not all cases end like this; most of the infants die soon after delivery.
post mortem Cesarean Sections in ANCIENT Greece and Rome
An early Roman law, Lex Regia, attributed to Numa Pompilius the second king of Rome (753–673 BCE) seems to require the procedure:
Negat lex regia mulierem quae praegnans mortua sit, humari, antequam partus ei exciditur: qui contra fecerit spem animantis cum gravida peremisse videtur.
The lex regia forbids the burial of a pregnant woman before the young has been excised: who does otherwise, clearly causes the promise of life to perish with the mother.
An even earlier written report of a post mortem cesarean birth is the stuff of myth. The Greek poet Pindar (c. 518-438 BCE.) described the birth of the god Asclepius by cesarean section, after his mother Coronis was murdered in a fit of rage by his father Apollo:
Thus he spoke, and with his first stride came and snatched the neonate from the corpse, while the burning flames parted for him. (Pindar, Pythian Ode Three, 43-44) 
The quicker the better
It has long been known that fetal survival from a post mortem cesarean section depends on the speed at which it may be delivered and resuscitated. The seventeenth century Portuguese physician Rodrigo de Castro (1546-1627) explained why:
Physicians should be warned of a very important matter. After the mother’s death, the neonate can not survive in the womb, unless it is removed from the uterus when the soul migrates from the maternal body or shortly before, while the mother is in agony and the vital spirits are still present. The reason is that when the mother’s life and her movements cease, the neonate’s life and its heartbeats also cease, which depends on the neonate’s distension and contraction of two umbilical arteries. When this movement ceases in the maternal body it also ceases in the neonate, because it does not carry the spirit through its mouth before cutting the navel. While the neonate is in the uterus it cannot breathe through its mouth, wrapped in membranes, closed within the uterus walls and surrounded by so many membranes and fluids; therefore we must believe that all those…who survived were removed when the mother’s heart was still beating or the mother was still alive.
(Castro, R. De universa mulierum medicina. Oficina Frobeniana, Hamburgo, 1603, II vol, II. 447. From here.)
Castro was spot on. Compare his insights to those published in this 2009 case report.
The performance of a perimortem Caesarean delivery is a challenging aspect of maternal resuscitation. Adherence to a ‘4 min rule’ means that the response team must rapidly assess the patient, institute appropriate resuscitation, and also prepare for delivery. The timing of restoration of adequate cardiac output is critical for both the mother and the baby, with the mother likely to experience hypoxia earlier in the course of an arrest due to the increased oxygen demands of pregnancy and decreased oxygen storage, while the fetus is reliant on the maternal circulation for oxygen supply.
In their recent review of the topic, Lior Drukker from Sha’arei Zedek hospital together with colleagues from Hadassah hospital in Jerusalem reviewed the protocol for a peri-mortem cesarean section. In these instances the mother is close to death or still undergoing CPR, but resuscitation efforts have not yet been abandoned. They provided this useful flow-chart for those considering the procedure:
And if you are quick enough the baby has a chance; a review of reports of infant survival from 1985-2004 identified thirty-eight perimortem sections, some resulting in twins and one, remarkably, that delivered triplets. Out of thirty-eight perimortem cesarean deliveries, thirty surviving infants were delivered. (But bear in mind that there is a tremendous amount of selection bias here. Physicians tend to publish only those cases in which there was a successful outcome.)
It may save the mother’s life too
Sometimes a perimortem section does not only save the life of the fetus; it saves the life of the mother too. There are several cases in the literature in which this has been described. When lying on her back, the mother’s circulation is severely impeded as the gravid uterus presses on the inferior vena cava, the main conduit returning blood to the heart. It also presses down on the aorta, the garden-hose-like vessel that carries blood away from the heart. Delivery of the baby immediately relieves these two compressions and improves the maternal circulation, which also makes any CPR efforts more effective.
The Talmud did not believe a post mortem cesarean section to be a futile procedure. Precisely because there was a chance of saving the infant, usual Sabbath prohibitions could be overridden. What we now understand is that occasionally this extreme last ditch effort might save not one life, but two.
[See also Bava Basra 142 for a further discussion of cesarean sections and maternal death rates.]