If the doctors agree that the pregnancy will affect the health of the mother, then it is permissible to have an abortion before the first forty days of pregnancy are completed. If it surpasses those forty days, then it is not permissible unless it is extremely necessary. As for dedicating oneself to the first son and being scared of having two daughters or likewise, then it is not permissible to have an abortion, only according to Dr Al Buwti on the condition that it is before the first forty two days of pregnancy, after that then it is not permissible.
The majority of scholars do not permit abortion even if it is a couple of hours of pregnancy, except in one circumstance, and that is if maintaining the pregnancy will bring danger to the mother’s life.
Sheikh Dr Yusuf Qaradawi says:
The basic ruling on abortion is prohibition. The prohibition becomes even firmer as the child grows and becomes more stable. In the first forty days the prohibition is less, and it is allowed for certain reasons. After forty days, the prohibition is much stronger, and it is only permissible to have an abortion for extremely strong reasons evaluated by scholars. The prohibition becomes solid and increases after one hundred and twenty days, as the child has now entered the stage in which the hadith has named ( breathing in to the soul). At this stage it is not permissible to abort the child, unless it as an extreme necessity and not just on whim, and if it is confirmed that it is necessary, thus it is permissible for the sake of necessity.
Necessity here is only in one case, and that is if maintaining the pregnancy will bring danger to the mother’s life, as the mother is the origin of life for the child, and the child is part of the mother. The origin is not sacrificed for the sake of the branch, and this logic in Islamic law can be confirmed by medicine, nature and the common law.