The Jerusalem district court issued the sentence as part of a plea bargain in which former Palestinian minister for Jerusalem affairs Khaled Abu Arafeh and Hamas MP Mohammed Totah admitted to "membership of a terror organisation" and staying in Israel without permits.
The two had barricaded themselves inside the offices of the International Committee of the Red Cross on July 1, 2010 and were arrested on January 23, 2012.
The ICRC compound is in the Sheikh Jarrah neighbourhood of occupied east Jerusalem.
The 30-month jail sentences were issued on Thursday, but the court only distributed news of the decision to the media today.
Hamas has 74 members in the 132-seat Palestinian Authority Legislative Council, which is based in Ramallah. Twelve of them are now being held by Israel, including Totah.