The woman, who is in her 20s and cannot be identified for legal reasons, has been diagnosed with a "moderately severe" learning disorder and a mood disorder.
Specialists caring for her say a termination is in her best interests.
But the woman's mother, a member of the Nigerian Igbo community, disagrees.
She says she could care for the baby and says abortion is against her Roman Catholic religious beliefs and her cultural beliefs.
Bosses at the NHS trust responsible for the woman's care have asked Mrs Justice Lieven to decide what is in the woman's best interests.
The judge began analysing evidence at a hearing in the Court of Protection, where issues relating to people who lack the mental capacity to make decisions are considered, at the Royal Courts of Justice complex in London on Thursday.
Mrs Justice Lieven is considering the case at a public hearing but she has ruled that the woman, who lives in the London area, cannot be identified in reports of the case.
She also says the NHS trust which has begun litigation cannot be named because publication of that name might create an information jigsaw which could lead to the woman's identity being revealed.
Barrister Fiona Paterson, who is leading the trust's legal team, told Mrs Justice Lieven that specialists thought a termination would be in the woman's best interests.
She said the baby might be taken into council care and said the woman would find the loss of pregnancy easier to recover from than separation from her child.
"(Her) treating clinicians consider that on balance, a termination is in her best interests," she said, in a written case outline.
"In broad terms (they) believe that as a result of her learning disabilities, (she) would find labour very difficult to tolerate and the recovery from a Caesarean section very challenging.
"(They) consider that (she) is likely to find the loss of a pregnancy easier to recover from than separation from the baby if he or she is taken into care.
"They also consider that (she) is at increased risk of psychosis if the pregnancy continues."
Lawyers said the judge would have to consider the terms of the 1967 Abortion Act, which says termination may be performed up to the 24th week of pregnancy, and the 2005 Mental Capacity Act.
They said any termination would have to be carried out soon.
The woman is independently represented by staff from the office of the Official Solicitor, who help mentally-ill people at the centre of litigation.
Barrister Susanna Rickard, who is leading the woman's legal team, said abortion did not appear to be in her best interests.
Barrister John McKendrick QC, who is leading the woman's mother's legal team, suggested that doctors were underestimating the woman's abilities.
"It is accepted that (the woman) lacks capacity to conduct these proceedings and to make a decision in respect of whether or not to consent to a termination and associated ancillary treatment," he told the judge in a written case outline.
"That being said, (her mother) considers that the applicant has underestimated (her) ability and understanding, and that more weight should be place on her wishes and feelings."
He added: "Termination is not in (the woman's) best interests."
Mr McKendrick said the judge had "no proper evidence" to show that allowing the pregnancy to continue would put the woman's life or long-term health at grave risk.
"The applicants have failed to carry out a proper best interests analysis," he said.
"Their evidence is premised on a narrow clinical view."
He added: "The application must be dismissed."
Stay up to date with the latest news stories from a Christian perspective. Sign up to our daily newsletter and receive more stories like this straight to your inbox every morning.