The judgement triggered anger from non-governmental organisations which said the girl had been raped.
The girl, from the northwestern region of Kef, had a sexual relationship with the brother of her brother-in-law.
She was 13 years and 11 months old and “was not raped”, said Chokri Mejri, the court official.
“We interviewed the girl and after verifying all the details, we considered her fit for marriage. As proof, she is pregnant,” he said.
Under Tunisian law, sex with a girl under 15 without the use of force is punishable by six years in prison, but the culprit can halt proceedings by marrying the victim.
“The two families demanded marriage to avoid a scandal,” Mejri said.
The court gave its green light on December 1 and the marriage agreement was signed on December 5, he said.
A wedding party had been planned for Sunday but was cancelled after the government’s child protection office called for the marriage to be annulled.
“When it’s a 13-year-old child, we can’t talk of a sexual relation with consent. It’s a rape,” the agency’s representative Houda Abboudi said.
“The court’s decision didn’t take into account the interests of this child… who will marry her rapist,” she said.
The Tunisian Association of Democratic Women (ATFD) rights group said the decision was “scandalous”.
“Judges think that at the age of 13… she can give consent,” said ATFD head Monia Ben Jemia.
“At 13 years old, one can’t give free and enlightened judgement, especially since there is no sex education at school,” she said.
Tunisia is viewed as being ahead of most Arab countries on women’s rights.
A bill to counter violence against women, proposed in 2014, is still waiting to be discussed in parliament