The case of abortion primarily discussed by the Talmud refers to what we call today "therapeutic abortion", i.e., when the life of the pregnant mother is in danger, and the doctors estimate that the only way to save her life is by taking out/killing the unborn baby. Independently of how Jewish Law considers the status of an unborn baby--we will analyze that later on--in this case, the early Talmudic sources (Mishna Aholot, 7:6, written ca.200 CE) already established unequivocally that if necessary, the unborn baby should be sacrificed in order to save the mother's life. The Mishna understand that this is a case of rodef ("chaser", a potential killer) and therefore the principle of "self defense" is applied: If A is attacked by B, if necessary, A can kill B to save his life (habba lehorgekha, hashkem lehorgo, Sanhedrin 72a). The baby, ironically, is viewed as an "involuntary" rodef.
The Talmud analyzes the Mishna's statement and asks what happens when the baby is actually at the very process of birth. Should we still apply the same criteria of self defense and allow to sacrifice the life of the baby to save the life of the mother? After all, in this extremely difficult situation, the mother is also a rodef toward the unborn baby! The answer of the rabbis, in very simple terms, is that before the baby is born, the life of the mother has priority, because the life of the baby is still a 'potential life'. But once the baby is born, i.e. when at least the head and /or the majority of the body is already outside, his life could not be sacrificed, and both mother and baby are in an equal situation. The doctors should try their best to save both lives.
(Adapted from penine halakha, Rabbi E. Melamed, liqutim B, page 241-242).
JEWISH CREATIVITY AT ITS BEST :)