Ibrahim Sharif, a founding member of the National Democratic Action Society (Waed) party which was dissolved in May last year, was also given a 500-dinar fine ($1,300) by Bahrain's lower criminal court.
Amnesty International and the Britain-based Bahrain Institute for Rights and Democracy (BIRD) denounced the sentence against Sharif.
"Bahrainis are being made to pay a hefty price for simply expressing their views," said Amnesty's Middle East research director Lynn Maalouf.
"It is flabbergasting that someone can be made to appear before a court and stand trial, let alone serve a sentence, for simply having expressed their opinion on Twitter."
Amnesty said the prosecution was based on a December tweet by Sharif in which he said "get out of here, man" and "the time has come for freedom for the Sudanese and the departure of the dictatorial president."
The tweet, accompanied by a picture of Sudan's President Omar al-Bashir, said that during his rule "civil wars have piled up, the South seceded, and he has impoverished, starved and degraded the kind and noble Sudanese people."
Bashir's three-decade rule has been rocked by nationwide protests since December.
Amnesty said Sharif will appeal the verdict and pay bail in order to stay out of prison until a decision by the appeals court.
Article 215 of Bahrain's penal code stipulates that anyone who "publicly insults" a foreign country or its leader can be imprisoned for up to two years in jail.
"Today's judgment is a slap in the face to freedom of expression and demonstrates the paranoia of the ruling family about the exposure of the human rights abuses of their fellow Arab dictators," BIRDS's advocacy chief, Sayed Ahmed Alwadaei, said.
Sharif was released from jail in July 2016 after having served a year on a charge of inciting hatred against the regime.
He had served a four-year jail term after the protests were crushed before being released under a royal amnesty in June 2015.
His party was dissolved in May 2017 as part of Bahrain's crackdown on dissent.