Specialists had told Mr Justice Newton that the woman, a Muslim from Iraq who moved to Britain with her husband a decade ago, was in a permanent vegetative state and would not recover.
The judge has ruled that medics can stop providing food and water via artificial means after analysing the case at a hearing in the Court of Protection, where issues relating to people who lack the mental capacity to make decisions are considered, in London on Wednesday.
Mr Justice Newton, who described the case as “desperate and sad”, said the woman could not be identified in media reports but said the health authority with responsibility for her care was based in Leeds.
He was told how doctors, and the woman’s husband, thought the treatment “burdensome”.
Medical experts said there was “no hope” of improvement.
The woman had been admitted to hospital in early 2011 when she was 35 weeks pregnant after being diagnosed with flu, the judge heard.
Her son had been born by caesarean section two days later.
She had then suffered a cardiac arrest, which resulted in brain damage, and lost consciousness.
Doctors told the judge how she had remained unconscious and unresponsive ever since.
Mr Justice Newton heard submissions from lawyers representing the woman and doctors before making a decision.
He was told that specialists thought that she should be allowed to die and that her husband agreed.
An imam had also agreed with doctors’ thinking.
The woman’s husband had told the judge how she had been “glamorous”, worked for a charity and hoped to be a teacher.
Solicitor Faith Salih, who represented the woman and is based with law firm Irwin Mitchell, said after the ruling: “The court was presented clear evidence showing that it was not in the patient’s best interests for life-sustaining treatment to continue.”