The judge was hearing a case that pits the bride's father, who wants to annul the wedding on religious grounds, against the couple, who said they wed to protect the bride from being sold into marriage to pay off her uncle's gambling debts.
The husband, Shumail Raj, 31, first brought the case to the Lahore High Court, appealing for protection from harassment by their relatives. But earlier this month the judge ordered the arrest of Raj and his wife, Shahzina Tariq, 26, for lying in court after Raj claimed she was a man.
On Monday, Judge Kahawaja Mohammed Sharif warned the couple they could face charges of committing an act of unnatural lust - which carries a penalty of between two years and life in prison - and perjury, which carries a maximum penalty of seven years.
The judge asked them to respond to the allegations at the next hearing on May 25. He also ordered police to arrest the doctor who performed the sex reassignment surgery on Raj and anyone who had sheltered the couple, including a charity worker.
Earlier in court, Sharif asked Raj whether she was a man or woman.
"Yes, I am a woman. I had two operations but still I'm a woman," said Raj, wearing trousers and shirt and showing stubble on her face. Tariq also admitted that she believed Raj was a woman.
"Islam and Pakistani law don't allow such marriages. A marriage of same sex is not allowed in our country," the judge told the court.
He ordered police to detain Raj at a jail in Lahore - it was not immediately clear if the facility would be for men or women - and Tariq at a jail in Faisalabad, the couple's hometown about 100 kilometers (60 miles) to the west of Lahore.
Sajjad Rana, the couple's lawyer, said Raj and Tariq never had sex.
Raj has previously told court-appointed doctors that she underwent gender reassignment surgery when she was 15 after she noticed changes in her voice and began to grow facial hair. The court-appointed medical panel found Raj had no penis, and a vagina that was surgically closed.
After the couple's arrest on Sunday, Raj told The Associated Press she married Tariq last September to save her from the arranged marriage.