The ruling on Monday also banned the weekly magazine Nichane from publishing for two months.
Prosecutors put Driss Ksikes, the editor-in-chief, and Sanae al-Aji, the writer, on trial for "damaging the Islamic religion, lacking proper respect for the king and publishing of writings contrary to public morals" in the weekly magazine.
Al-Aji, the first female reporter to stand trial in
jokes were in common usage among Moroccan people and were not part of her own beliefs.
The controversial piece was published as a cover story in the magazine's special edition in early December.
The magazine's lawyer, Chawki Benyoub, said he would appeal against the ruling.
International media rights groups had widely condemned the trial of the two journalists as a violation of press freedom.
The weekly is owned by a news group that also publishes the irreverent French-language magazine TelQuel.