Wa `alaykum As-Salamu wa Rahmatullahi wa Barakatuh.
In the Name of Allah, Most Gracious, Most Merciful.
All praise and thanks are due to Allah, and peace and blessings be upon His Messenger.
Dear brother in Islam, thanks a lot for your interesting question, which reflects your deep belief in the fact that Islam has answers for every problem facing mankind. Our utmost wish is just for all of us to adhere to the teachings of this great religion which came to save mankind from the peril of succumbing to the material life, to rescue them from darkness of following whims and self-inclinations to the light of guidance and eternal prosperity.
As regards your question, following is what the eminent Muslim scholar, Sheikh Yusuf Al-Qaradawi, states in his well-known book, The Lawful and the Prohibited in Islam:
“While Islam permits preventing pregnancy for valid reasons, it does not allow doing violence to it once it occurs.
Muslim jurists have agreed unanimously that after the fetus is completely formed and has been given a soul, abortion is haram. It is also a crime, the commission of which is prohibited to the Muslim because it constitutes an offense against a complete, living human being. Jurists insist that the payment of blood money (diya) becomes incumbent if the baby is aborted alive and then died, while a fine of lesser amount is to be paid if it is aborted dead.
However, there is one exceptional situation. If, say the jurists, after the baby is completely formed, it is reliably shown that the continuation of the pregnancy would necessarily result in the death of the mother, then, in accordance with the general principle of the Shari`ah, that of choosing the lesser of two evils, abortion must be performed. The reason for this is that the mother is the origin of the fetus; moreover, her life is well-established, with duties and responsibilities, and she is also a pillar of the family. It would not be possible to sacrifice her life for the life of a fetus which has not yet acquired a personality and which has no responsibilities or obligations to fulfill.
Imam al-Ghazzali makes a clear distinction between contraception and abortion, saying that contraception is not like abortion. Abortion is a crime against an existing being. It follows from this that there are stages of existence. The first stages of existence are the settling of the semen in the womb and its mixing with the secretions of the woman. Then come the next gestational stage. Disturbing the pregnancy at this stage is a crime. When it develops further and becomes a lump, aborting it is a greater crime. When it acquires a soul and its creation is completed, the crime becomes more grievous. The crime reaches a maximum seriousness when it is committed after it (the fetus) is separated (from the mother) alive.”
Allah Almighty knows best.