The court in Kairouan last week handed down the maximum term under a controversial article of the criminal code that criminalises sex between males, Boutheina Karkni said.
The six were also banned from the central city for five years after they complete their sentences, she said.
The young men were detained in November and December after "neighbours denounced them" and were made to undergo anal examinations, she said.
Karkni described the ruling as "extremely harsh" and said an appeal hearing should take place "in two to three weeks" in the nearby coastal city of Sousse.
Also Read
Local rights group Shams, which calls for decriminalising homosexuality in Tunisia by revising Article 230 of the penal code, condemned the judgment.
Human Rights Watch's country director also denounced the ruling as "a grave case of infringement on people's private lives and physical integrity".
Amna Guellali described the sentences, which included the "extremely rare" penalty of "banishment", as "mediaeval and not consistent with Tunisia's evolution".
Balkis Mechri of the local Human Rights League agreed.
"The banishment really is scandalous," she said, calling on civil society to "react strongly" in the case.
"Our job is to uphold the law," radio station Shems FM reported him as saying.
In September, a court sentenced a student to a year behind bars in Sousse on charges of homosexuality, also after he was examined anally.
He was released in November pending an appeal hearing expected on Thursday.
After the September judgment, then justice minister Salah Ben Aissa made a controversial call for Article 230 to be scrapped and was sacked in October.