Praise be to Allah.
If the fetus has reached the age of four months, then the soul has already been breathed into it, so deliberately aborting it would be regarded as killing a soul - which is a very grave major sin. The doctors' opinion that it is malformed is no excuse at all. If it is miscarried or stillborn, or it is born alive and dies shortly thereafter, the parents will be rewarded for bearing the calamity of their loss, and if it lives and has some kind of disability, they will be rewarded for their patience in taking care of it. Everything that happens to the believer is good for him, but wilfully destroying a soul is nothing but evil and sin. We must also take into consideration the errors that may occur in doctors' reports, and that fact that the condition of the fetus may change and improve.
And Allaah knows best.