Praise be to Allaah.
Yes, that is permissible, but with regard to aborting the foetus, some scholars have allowed that under certain conditions:
1-That the soul should not yet have entered the foetus, i.e. within the first four months of the pregnancy from the time of conception.
2-There should be a necessary reason for doing so, such as handicap or deformity which is discovered in the pregnancy, or a risk to the mother. At the same time, if a person can be patient and put his trust in Allaah, that will be better for him with his Lord.
Shaykh Sa’d al-Humayd
But it is essential to note that the doctors may be mistaken in their reports and that the test results are often imprecise. So we must be very careful when taking serious decisions such as deciding to abort a pregnancy on the basis of such reports. Some shortcomings in a newborn may be made up later on, or a fault may be removed and the child may be born healthy. If we assume that the child is born at full term with a deformity, then bearing that with patience and seeking the reward of Allaah by caring for the child will not be lost with Allaah. It will not be a loss, as it is viewed by many materialists, some of whom want to kill the handicapped because they are a burden on society. Allaah is Most Wise in all that He creates and decrees, may He be glorified and exalted.