1227 GMT October 19, 2018
The two were being represented in a lawsuit by the American Civil Liberties Union (ACLU), who said they had fled "extreme sexual and gang violence", BBC reported.
The judge said it was unacceptable they had been removed during their appeal.
He reportedly also said Attorney General Jeff Sessions could be held in contempt of court for the deportation.
The mother and daughter were part of a case filed by the ACLU and the Center for Gender and Refugee Studies on behalf of 12 mothers and children who said they had fled violence, but were at risk of deportation.
A tightening of rules in June by Sessions means victims of domestic abuse and gang violence no longer generally qualify for US asylum.
The government had pledged not to deport anyone in the case before Friday at the earliest, ACLU said.
But ACLU said they learned during Thursday's emergency hearing that the mother and daughter had already been put on a flight back to El Salvador by US authorities.
Washington DC District Court Judge Emmet Sullivan said that it was unacceptable that people claiming asylum had been removed while lawyers argued their case.
He branded the situation ‘outrageous’ and ordered the pair be returned immediately, according to reports.
An official from the Department of Homeland Security told Reuters that the agency worked to comply with the court's order.
"Upon arrival in El Salvador, the plaintiffs did not disembark and are currently en route back to the US," the department said in an emailed statement.
The mother and daughter are said to have arrived back in Texas, where they were being held, by Thursday night.
According to the lawsuit, the migrant mother, known under the alias ‘Carmen’, came to the US with her young daughter after two decades of being abused by her husband and threatened to death by a local gang in her native El Salvador.
But their case was halted when officers found they did not have a ‘credible fear of persecution’.
The case comes at a time when US migrant policy remains firmly under the spotlight after it emerged in June that migrant children were being separated from their families at the US border.
The policy led to widespread outrage and condemnation.
US President Donald Trump signed an executive order seeking to end the policy, but more than 500 children remained apart from their families as of Thursday.