Mohamed Aden Dirir was arrested last month following an article for a local news website in which he alleged exam fraud by teachers at private schools in the capital, Hargeisa.
Local journalists say the one-day trial was held without his lawyer. He was sentenced on Sunday. Dirir's family told reporters they would appeal.
The New York-based Committee to Protect Journalists says Dirir "should never have been prosecuted in the first place" and the trial was carried out in an unjust way.
Local media organizations have long said Somalia's penal code, written in 1960, is designed to silence journalists and curtail freedom of expression.