Poland already has one of the toughest abortion laws in the European Union.
After the new decision goes into effect, abortions will only be allowed if the pregnancy is the result of a crime such as incest or rape, or threatens the life or health of the woman.
The ruling by the Constitutional Tribunal came after a group of conservative MPs from various parties last year urged tighter abortion rules.
"The mere fact of a fetal impairment or an incurable disease cannot decide on the termination of pregnancy from the constitutional perspective", Constitutional Tribunal judge Justyn Piskorski said after the decision.
The court ruling was welcomed by anti-abortion campaigners but triggered anger among women’s rights activists and leftist groups.
The leader of Poland’s nationalist Confederation party, Krzysztof Bosak, tweeted: “The only possible ruling consistent with the constitution was made. Pity we had to wait so many years for justice!”
Krzysztof Gawkowski, who is the head of Poland’s Left opposition alliance, said in a Tweet that women will now have to "give birth to terminally ill children who will die in terrible torments. This is not politics or religion, it is a crime against humanity."
Since the conservative Law and Justice party came to power in late 2015, there have been appeals for a blanket ban on all abortions in Poland, and calls to penalise doctors who perform such operations and women who terminate pregnancies.
But proposals for tighter laws triggered extensive street protests, and the government has so far shied away from toughening the rules.