First of all, it is to be stated that Islam forbids abortion in all stages of pregnancy. When the pregnancy reaches 120 days old, abortion becomes totally forbidden and is deemed a form of murder that results in compensation becoming liable. If abortion is done prior to this period, no compensation is liable but one should ask forgiveness and promise never to commit it again. In addition, it is highly recommended to do much righteous deeds such as giving in charity, etc.
Sheikh Yusuf Al-Qaradawi, states the following: “With regard to abortion, the basic principle concerning abortion is that it is unlawful (haram); it is not allowed from the moment of conception when it becomes a new being and is placed in a place of safety, i.e., the womb, even if this being is the result of an unlawful relationship such as adultery. In the case of the Ghamidi woman who had confessed to adultery and thus the punishment of stoning became obligatory, the Messenger (peace and blessings be upon him) told her to go away until after she had given birth; then after she had given birth, he told her to go away until the child was weaned.
The above is the trend I follow in my fatwas on this issue in normal cases. But there are some jurists who think that it is permissible to have an abortion within the first forty days of pregnancy. Some of them even permit it until before the soul is breathed into the embryo.
Despite the above-mentioned view which I follow, there are some exceptional cases in which one may adopt one of the latter views, and the stronger the excuse, the clearer the reason for the dispensation is, and if that is within the first forty days, it means that the dispensation is more appropriate.
Undoubtedly raping a Muslim woman by an evil enemy is a strong reason for the victim and for her family to have an abortion, for she will hate this fetus, the result of this iniquitous attack, and she will want to get rid of it. So this dispensation is to be given because of necessity, especially in the first days of the pregnancy. But this case of necessity should be determined by religious scholars, doctors and people of wide experience and wisdom. Otherwise, the original rule (of prohibition) should be applied.
Moreover, there is nothing wrong with a Muslim woman who has suffered this disaster to keep the fetus without getting rid of it. If it is decreed that it should remain in her womb for the usual term and she gives birth to it, then it will be a Muslim child, as the Prophet (peace and blessings be upon him) said: ‘Every child is born with a true faith (i.e., to worship none but Allah alone).’ (Reported by al-Bukhari) It has been stated in the books Fiqh (Islamic Jurisprudence) that if the parents have different religions, the child should follow the parent who has the best religion. This is in cases where the father is known, but what about the child who has no father? He is a Muslim child, no doubt, and the Muslim society is obliged to take care of his upbringing, to spend on him and to bring him up well. They should not leave the burden to his poor, suffering mother.”
Having stated the above, it becomes clear that pertaining to abortion, the basic principle concerning it is that it is unlawful. But, undoubtedly, pregnancy due to rape or adultery may be a reason for the victim to have an abortion in the first days of the pregnancy. Moreover, it is preferable if she kept the fetus without getting rid of it.