Many beings undertake a stage of life as fetus. Perhaps you have dry-roasted peanuts at home? Open one, split it in half: you will see a small bean fetus: there are even small leaves. But it is not understood to be a peanut (plant), but a peanut (food): it had not manifested its own life.
The Garbha Upanishad describes the fetal stage of a human in the context that "humanity" is a form. Until the 7th month the fetus is primarily formed through actions of the mother and father reflecting the basic genetic makeup and predispositions of a person are inherited. Modern science confirms that profound processes affect the RNA of the fetus to turn on and off genes at this time. The jiva enters into the fetus by the 8th month of pregnancy, the earliest possible time when the fetus might leave the womb and survive. Thus it is understood the form of the fetus is manifested by the 9th month, whether within the womb or out of it. This reflects the potential for individuality of the fetus. But at this stage, the fetus is not capable of manifesting its own life, its own individuality, not being able to undertake Jnana Yoga or Brahmacharya until after birth. The fetus will not mature into a person before it is 35 years old - without assistance in maturation.
Jiva is a word that means "condition of life" or "manner of life." A coppersmith is a tamrajiva: copper is their life. Grain, the basis of human diet, is jivanarha. When life ends (jivananta), it is understood that the conditions for living have ended, in the sense that a candle is extinguished when deprived of oxygen, wax fuel, or wick to carry wax to the air in fueling combustion.
What the Garbha Upanishad teaches is that body and mind are important to life, but are not life itself. A heartbeat is not a sign of life, neither is thought, nor is the capacity for either. These are not self. This teaching is repeated in numerous instances by the Buddha Gotama, an Avatar of Vishnu - and in all the other scriptures. These are manifestations of the conditions of self - the jiva.
If a cesarean birth were attempted before the 9th month, the fetus could not manifest its own life, and would not have been alive to die. What is not alive cannot be killed: there is no ethical objection to aborting pregnancy by destroying a fetus - a fetus is only potentially alive. In the same way a peanut seed is potentially a plant, or a match is potentially a fire. In fact, there is no ethical objection to infanticide, or other murder per se: murder is required to eat, and we kill animals, plants, fungi to do so. We kill bacteria and insects to survive, in self-defense. The manner and necessity of the killing is what matters when all life is equal. What what is not alive cannot be killed.
The Mahabharata provides an excellent illustration of this complex concept. In the beginning of the epic, the Goddess Ganges is chosen by the Vasus to be their executioner. They were condemned to live lives of suffering and then die for crimes against Sage Vasishta. However, because the Vasus were not beings who could not live, and who not die, to fulfill their duty to the Dharma (their punishment) they had to play the part of beings which could be born and die: for this purpose of upholding the Dharma they assumed Avatara. During the proceedings, their punishment was reduced somewhat: they were permitted the grace of choosing their executioner, and all but one were permitted to have the shortest life of suffering possible. Goddess Ganges then assumed human form, as well, so she may fulfill the Dharma.
To permit these Vasus the shortest life possible, Goddess Ganges did not commit an abortion: the fetuses of these Vasus were not alive, and that would have been permitting them to evade the punishment of life and death. Instead, she waited until they emerged from the womb to kill them.
The duties of Dharma are clear. A fetus is a component of a woman's body, and therefore a pregnant woman has duties to the father and to the maturation of the successful potential child itself. Drinking alcohol, using marijuana, or otherwise damaging the fetus is wrong, even if the fetus is not alive. However, the very same duty to protect herself and the fetus can result in the necessity to abort the pregnancy: though the father or mother may desire birth, both have a duty to protect the mother and fetus: this duty sometimes conflicts with the duty of maturation. However, since the duty to protect mother was taken up before the duty of maturation (the mother assumed a duty of self-preservation when born, and the father assumed the duty of mother-preservation when he impregnated the mother), this is the primal duty. Other duties may also apply: a pregnant woman may have duties to the State as a soldier, or to other children who she may not be able to feed.
Options in protecting the mother and/or unborn baby include either abortion or divorce.
Abortion can prevent a being from taking life, and suffering needlessly - it can also protect a mother from needless suffering. In an orchard, an apple tree is stripped of some of its flowers and buds to ensure that the remaining fruits mature, and mature more perfectly. Some tomatoes are pruned of their first flowers to ensure the plant grows to a better size. These are examples to demonstrate the ethical concept that if the mother anticipates being unable to raise the unborn child adequately, or that the childbirth will harm the mother physically or in her own physical, mental and emotional maturation, she may abort the pregnancy without regret.
Divorce is an act of releasing the spouse from their duty: one parent disagrees, the duty of the father or mother may be relieved by divorce. The Goddess Ganges divorced her human husband, giving him the one child she did not kill - and when the father accepted the responsibility of raising the child alone, she was relieved of the burdens of that child's suffering. However, such a transference must be mutually agreed upon accordance with marriage.
If such an agreement cannot be reached, the highest duty, self-preservation, may be relied upon by the mother: she has a duty, first and foremost, before considerations of her husband, to protect herself. Making a child must be a consensual act, just like any sexual activity.
Determining whether there is more or less harm in maturing a birth is nuanced. Like the duty regarding euthanasia, or even eating meat, the lesson of duty is that hard and fast rules cannot guide complex decisions: rather, understanding of duty and purpose will illuminate the correct course of action. It is the process of rational, logical decision-making which results in spiritual growth. If you have acted in accordance with your duty, and fulfilled your obligation, do not have regret: you have acted selflessly, without regard for reward or punishment, pain or pleasure, praise or blame. You have done nothing you should not have done, and did what you should have done.