Wikipedia is my friend.
Muslim views on abortion are shaped by the Hadith as well as by the opinions of legal and religious scholars and commentators. The Quran does not directly address intentional abortion, leaving greater discretion to the laws of individual countries. In Islam, the fetus is believed to become a living soul after four months of gestation, and abortion after that point is generally viewed as impermissible. Many Islamic thinkers recognize exceptions to this rule for certain circumstances. American academic, Azizah Y. al-Hibri, notes that "the majority of Muslim scholars permit abortion, although they differ on the stage of fetal development beyond which it becomes prohibited." According to Sherman Jackson, "while abortion, even during the first trimester, is forbidden according to a minority of jurists, it is not held to be an offense for which there are criminal or even civil sanctions." There are four different Sunni Islam schools of thought – Hanafi, Shafi‘i, Hanbali, and Maliki – and they have their own reservations on when abortions can happen in Islam.
In practice, access to abortion varies greatly between different Muslim-majority countries. In countries like Turkey and Tunisia, abortions are unconditionally legal on request. On the other hand, in 18 out of 47 Muslim-majority countries, including Iraq, Egypt, and Indonesia, abortion is only legally permitted if the life of the mother is threatened by the pregnancy. No Muslim-majority country bans abortion in the case of the mother's life being at risk. Other reasons that are permitted by certain Muslim-majority countries include preserving a woman's physical or mental health, foetal impairment, cases of incest or rape, and social or economic reasons. There is great variation within Muslim-majority countries as to which are legally accepted reasons for abortion.