The girl is believed to be 10 years old and was due to give birth in four months, police said. Her stepfather was arrested in an ongoing case of abuse, authorities said. Indian law prohibits disclosing the names of rape victims.
The court's decision comes a day after a medical board examined the girl at the Post Graduate Institute of Medical Sciences in Rohtak district in India's northern state of Haryana.
"The court has asked the doctors to terminate this pregnancy, " Dr. S.K. Dhattarwal, head of the institute's forensic medicine department, told CNN.
"We are examining the female to determine the best method for abortion. It will be carried out in the evening."
The request for an abortion was moved to a local district court Tuesday because the girl was more than 20 weeks' pregnant.
There was long-term abuse, police say
After suspecting her child might be pregnant, the mother, a migrant laborer from the impoverished state of Bihar, took the girl to a doctor.
Once confirmed, the girl told her mother the accused -- who is also her paternal uncle -- had been sexually assaulting her, according to local media reports.
Police said there were no official records of the child's birth date.
"The victim is 10 years old but may be one or two years older," Pankaj Nain, superintendent of Rohtak police, told CNN.
"The stepfather has been arrested and is in jail. The victim has been given counseling and necessary medical care, and her statement was recorded before a magistrate," Nain said.
The abuse "had been going on for years," he added.
Another brutal case
The case comes to light only days after the body of a 20-year-old woman was discovered in the same district.
In a particularly brutal case, a postmortem examination found the woman had been raped with sharp objects. Her face had also been smashed with a brick, and a car ran over her body so she could not be identified, according to a report in the Hindustan Times.
Both cases in Rohtak follow the May 5 ruling by India's Supreme Court upholding the death penalty
for four men convicted in the infamous December 2012 gang rape
of Jyoti Singh Pandey.
Police said the men took turns raping the woman, using an iron rod to violate her as the bus drove around the city for almost an hour.
The victim's injuries were so severe some internal organs had to be removed. She died two weeks later at a hospital in Singapore.
She later became known as Nirbhaya, or the "fearless one," and her case led to protests across India coupled with intense media coverage and scrutiny over the country's problem of sexual violence against women.