The woman should abort her 25-week-old foetus "forthwith", decided the two-judge bench, which accepted a report by a seven-member medical board.
The court-appointed board had reported that the woman would suffer "severe mental injury" if the child was born. It also said the baby would have to go through multiple surgeries for its cardiac ailments.
"Keeping in view the report of the medical board, we are inclined to allow the prayer and direct medical termination of pregnancy," said judges Dipak Misra and M Khanwilkar.
The law bans abortion beyond 20 weeks of pregnancy unless it is allowed by a court in specific circumstances, such as a serious risk to either the baby or the mother. The woman said in her petition that the "denial of her right to an abortion has caused her extreme anguish" and has forced her to continue her pregnancy despite knowing that her baby may not survive.
Earlier this year, a 24-week pregnant woman in Maharashtra was allowed to abort her baby, which had a life-threatening condition.