A third bill introducing tight controls on the media is expected to be passed later by parliament, where Mr Mugabe's Zanu-PF has a large majority.
The measures are a key part of Mr Mugabe's strategy to win elections on 9-10 March, correspondents say.
The security bill also makes it an offence to criticise the president, which correspondents note makes it impossible for the opposition to campaign.
An hour before the election dates were announced on Wednesday, Zimbabwe's military commanders declared they would only support a leader who fought minority white rule in the 1970s.
This is seen as a warning that they would not support a government led by Morgan Tsvangirai, Mr Mugabe's main opponent.
Mr Tsvangirai said the army's declaration was a "de facto coup", describing it as "mischievous, irresponsible and treacherous."
Zimbabwe 'tragedy'
In Wednesday's marathon session on the Public Order and Security Bill, the opposition did win a few concessions.
In the original draft, the police were to be given powers to detain without charge for seven days - this will remain at 48 hours.
But legislation banning unauthorised gatherings and requiring Zimbabweans to carry identification documents has been approved.
The UK's International Development Secretary, Clare Short, has described the current state of Zimbabwe as "a tragedy of enormous proportions".
Ms Short, who is attending an African regional conference in Sudan, said the international community should monitor the situation but its hands were tied.
Army threat
With the elections in early March, BBC correspondents say Mr Mugabe's election chances are unlikely to be affected by any decision to expel the country from the Commonwealth, as the heads of government do not meet until the beginning of March.
Zimbabwean journalists say the proposed media law would make it impossible to work, as they would need to get accreditation from the information ministry every year.
Other restrictions include a possible prison term for writing "unauthorised" accounts of cabinet discussions.
The opposition had defeated the amendments to the electoral law on Tuesday.
Bills rejected by MPs are not normally allowed to be resubmitted to the same parliamentary session.
Flanked by all of Zimbabwe's security chiefs, defence forces commander General Vitalis Zvinavashe told journalists on Wednesday:
"Any change designed to reverse the gains of this revolution will not be supported."
Change or "chinja" is the main MDC slogan.
Until now, the military has strenuously denied accusations that it supports Zanu-PF, maintaining that it will loyally serve the government of the day - whoever wins elections.