The male lawmakers attacked Amy Ndiaye after she criticised an opposition religious figure.
The judge also ordered Mamadou Niang and Massata Samb to pay Ms Ndiaye five million CFA francs ($8,100; £6,750) in compensation.
In a video widely shared online, Mr Samb is seen walking towards Ms Ndiaye and slapping her during a routine budget debate on 1 December
Ms Ndiaye, a member of the ruling Benno Bokk Yakaar coalition, fainted in parliament after the attack and there were fears that she would lose the baby.
Despite the video evidence, lawyers for Mr Niang and Mr Samb argued in court that their clients had not physically attacked Ms Ndiaye.
They also argued unsuccessfully that the two lawmakers were immune to prosecution.
“They are going to remain in prison pending an appeal,” one of their lawyers, Abdy Nar Ndiaye, told AFP.
Source: Nana Kay News