It went by the recommendations of an expert panel of doctors which said the foetus had "least chance" of having a congenital handicap at birth.
Doctors also said it could be risky for the mother if she had an abortion at such an advanced stage of pregnancy.
Niketa and Haresh Mehta approached the High Court of Mumbai in western India after doctors told them that the baby had a congenital heart block. Under Indian laws abortions are not permitted beyond the 20th
week. Hence their plea to the court.
The couple had urged the court to allow a delayed abortion because they learnt about the problem only in the 24th week of pregnancy.
Their doctor told the court that certain ailments could be detected only between the 20th and 24th week of pregnancy.
In their submission before the court, the couple said the child would need a pacemaker from the birth and would not be able to lead a normal life.
They also said that they might not be able to afford expensive medical treatment for changing the pacemaker every few years.
A pacemaker operation costs nearly $2,500.
An earlier report by another panel of doctors was inconclusive. They did say there was a fair chance that the baby would be born with some congenital heart problem, but they also felt the situation might not warrant termination.
Hence the court appointed a new panel that seems to have ruled out chances of abnormalities in the foetus.
Meantime the Mehtas have also rejected an offer from a nonprofit to take care of the child once born.
"We got a call from an NGO offering to place the baby elsewhere. But how can we? Hum apna dukh doosro ke saath kaise baate? (How can we share our sadness with someone else?) Even if they have the money to look after the baby, the child will always be compared with other normal children," Haresh Mehta told Times of India.
"Besides, with the child on a pacemaker, there may be many complications, he added. "What if the surgery fails? It could get septic. The child will have a tough life. As it is, life in Mumbai is such a struggle and so fast.
"The child would be at a disadvantage right from the start. How can the child travel? By train? We have thought it over a lot in the past few weeks. How can a mother and father watch their own child die, whether it is with us or anyone else? That's why we said no to the NGO."
Help has been offered from other quarters too. A private medical aid company wrote to Times Of India
expressing an interest in offering the baby a free pacemaker. A pro-life group in the city, not willing to be identified, said it was willing to confidentially find an alternate home for babies with congenital heart defects.
The Mehtas said that what was really needed now was greater awareness of the need for suitable changes to the abortion laws of the country and noted that in some western countries abortion was permitted up to 24th