When a fetus is tested and it is determined that it has a disability or deformity, many poskim [16] state that there is no allowance for abortion. Rabbi Waldenberg disagrees and rules that when the resulting child’s deformity will cause stress that the parents will not be able to handle, it is permitted to abort. Rabbi waldenberg says “ there is no greater pain than to have a child that will die and there is nothing you can do to fix it.” For most types of deformities, Rabbi Waldenberg permits abortion only until 3 months. If the child has Tay Sachs he allows abortions even up until 7 months.[17]
An issue can also arise when the fetus in question would be born a Mamzer, a child from an illegitimate sexual relationship. Because of the adulterous affair the woman is deserving of the death penalty. Since the fetus is a part of the mother, and not it’s own entity, it too is technically liable for the death penalty and one can therefore, according to Rav Yaakov Emden, abort it. [18]
A question arises if the mother will experience severe mental distress if the baby is born. Rabbi Waldenberg holds that abortion is not murder at all, and that mental distress can be equated with physical pain. Therefore, abortion would be allowed if one’s rabbi determines that the mental stress is the same as the physical would be. [19] Rabbi Unterman takes a similar approach to the issue. Rabbi Unterman does believe that abortion is considered akin to murder, and therefore cannot be allowed in cases of mental anguish. However, if the psychological distress that the mother would feel would cause suicidal tendencies, Rabbi Unterman would permit abortion. [20]
https://halachipedia.com/index.php?title=Abortion