The woman's mother has revealed that she did not want doctors to be allowed to abort her daughter's child because of her religious beliefs.
The social worker who has been involved with the woman, who is 22 weeks pregnant, for about two years has also said she should be allowed to have the baby.
Mrs Justice Lieven is 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, at the Royal Courts of Justice complex in London.
Doctors say a termination is the best option.
Specialists say the woman would find labour very difficult to tolerate and recovery from a Caesarean section very challenging and that her mental health could worsen if the pregnancy continues.
They say the baby might be taken into council care and its mother would find the loss of pregnancy easier to recover from than separation from her child.
But the social worker said both outcomes would be equally distressing for the woman.
"(She) knows she is pregnant," said the social worker.
"I believe the best interests for (her) are to have her baby."
The woman's mother is also pro-life.
She says she could care for the baby and her daughter could help.
Mrs Justice Lieven is considering the case at a public hearing but 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, and the council which employs the social worker, cannot be named because publication of their names might create an information jigsaw which could lead to the woman's identity being revealed.
The woman is in her 20s and has been diagnosed with a "moderately severe" learning disorder and a mood disorder.
Mrs Justice Lieven has been told that the "circumstances of the conception" are "unclear" and a police investigation is ongoing.
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.