Toni Foketi was detained because his immigration ID had expired, and his sponsor, his wife, had moved to the mainland for work.
The NGO, Alliance for Strengthening Families, helped pay for a lawyer so Mr Foketi could eventually go to court for an immigration hearing.
But the court ruled that he should have left the territory already and by not doing so he had violated the conditions of his probation from a previous crime.
RNZI reports an advocate with the NGO, Brian Loma, said that meant Mr Foketi was free to return to Tonga with his son but he had to pay for their airfares.
With some assistance Mr Foketi and his son returned to Tonga.
But Mr Loma said what happened to Toni Foketi was unfair and he wouldn't wish it on anyone.
"You know in this situation it seems like when the immigration would detain somebody, that they should have a process to ensure that that person would have a speedy departure from the country," Mr Loma said.
"There should've been a way for him to go home or to accelerate that process from when he was taken there to the two years before he had a hearing."