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.
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.
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.