The Muslim Brotherhood says its members were fired on outside a barracks where they believe he is being held, during a sit-in demanding his reinstatement.
However the army said a “terrorist group” had tried to storm the barracks.
Mr Morsi, an Islamist and Egypt’s first freely elected leader, was ousted by the army last week after mass protests.
Scores of people have been killed since the unrest began last weekend.
Mr Morsi is believed to be detained at the Presidential Guard Club, in the eastern Nasr City district of the capital.
His supporters – many of them members of the Muslim Brotherhood movement he comes from – have been staging a sit-in there demanding his reinstatement.
After Monday morning’s violence, the hardline Salafist Nour party – which had supported Mr Morsi’s removal – said it was withdrawing from talks to choose an interim prime minister, describing the shooting incident as a “massacre”.
Both the Brotherhood and the Egyptian health ministry said at least 40 people had been killed, including an army officer. Some 300 people were reported to be wounded.
TV channels broadcast images of dead and injured people being taken to a makeshift hospital in the Rabaa al-Adawiya mosque, where Brotherhood supporters have been based.
But there were conflicting reports over how the violence unfolded.
The Muslim Brotherhood said the army had raided its sit-in at about 04:00 (02:00 GMT) as protesters were performing dawn prayers.
“The protesters were taken unawares and the troops used live ammunition, bird shot and tear gas,” protester Alaa el-Hadidi told the BBC.
Another protester, Mahmud al-Shilli, told AFP news agency that troops had used tear gas but that a group of men in civilian clothing had then opened fire.
“The thugs came from the side. We were the target,” he told AFP.
The Freedom and Justice Party, the Brotherhood’s political wing – which took nearly half the seats in last year’s historic election – called on Egyptians to stage an “uprising” in response to the incident, against “those trying to steal their revolution with tanks”.
It also urged “the international community and international groups and all the free people of the world to intervene to stop further massacres” and to stop Egypt becoming “a new Syria”.
But in a statement read on state media, the army blamed the shooting on “an armed terrorist group” that had tried to storm the barracks.
It said an army officer was among those killed and that a number of others were wounded, some critically.
The statement said some 200 people had been arrested and were found to have weapons, ammunition and petrol bombs.
The army later said two soldier had been kidnapped by Morsi supporters.
It said that in two separate instances, men armed with guns and knives had forced the soldiers into vehicles.
Mr Morsi was ousted on Wednesday by the military, which said it was responding to the demands of the people.
Protesters had been demanding that Mr Morsi step down, saying he had failed to tackle Egypt’s economic problems and was becoming increasingly authoritarian.
He was replaced on Thursday by Adly Mansour – the head of the Supreme Constitutional Court. He has pledged to hold elections soon, but has as yet given no date for them.
The army has insisted it does not want to remain in power.
On Sunday, tens of thousands of both supporters and opponents of Mr Morsi rallied in many Egyptian cities.
The BBC’s Jim Muir in Cairo says that despite the conflicting reports about Monday’s violence, it is clear that blood has been shed, which will aggravate an already critical situation.
The withdrawal of the ultra-conservative Nour party from the political transition talks will also set back efforts to appoint a new prime minister, our correspondent adds.
Party spokesman Nadder Bakkar said it had “decided to withdraw immediately from all negotiations in response to the massacre”.
Though the Islamist party had backed the army-led “roadmap” to new elections, it had blocked the appointment of two potential prime ministers because of concerns over the shape of a new constitution.