Mr Morsi's supporters have been staging sit-ins demanding he be reinstated.
The Egyptian army has warned it will use force against any group resorting to violence during rival rallies planned for Friday.
Army chief Gen Abdel Fattah al-Sisi has called on people to take to the streets to give the military a mandate to confront "terrorism".
Supporters of ousted President Mohammed Morsi are also expected to demonstrate to demand his reinstatement.
Mr Morsi was detained on 3 July. The UN chief has called for his release.
In a statement on Thursday, Ban Ki-moon called on the Egyptian military to free Mr Morsi and other members of the Muslim Brotherhood "or have their cases reviewed transparently without delay".
Mr Morsi - Egypt's first democratically elected president - was ousted by the army after mass protests against him on the anniversary of his election.
On Thursday, military spokesman Col Ahmed Mohammed Ali said the army was respectful of peaceful protests, but said that violence or terrorism would be "dealt with decisively and with force".
A statement on a Facebook page affiliated to the military said: "We reaffirm that the Egyptian armed forces... never uses its weapons against its own people but will do so against violence and black terrorism which has no faith and no nation."
Since Mr Morsi was ousted dozens of people have died in clashes between supporters and opponents of the Islamist leader. Militants have also staged deadly attacks in the Sinai peninsula.
In his call for demonstrations on Wednesday, Gen Sisi said he was not calling for unrest. Military spokesmen have insisted that the army is not seeking to target any particular group.
The Tamarod movement that organised the protests which preceded Mr Morsi's removal has urged its supporters to take part in Friday's rallies.
"We call on all of the great Egyptian people to gather in the squares on Friday to officially demand that Mohammed Morsi be put on trial and to support the Egyptian armed forces in its coming war on terrorism," it said.
The Muslim Brotherhood, which backs Mr Morsi, said Gen Sisi was "calling for civil war".
The Muslim Brotherhood's spiritual leader Mohammed Badie said the army's removal of Mr Morsi was equivalent to destroying one of Islam's holiest sites, the Kaaba in Mecca.
"I swear by God that what Sisi did in Egypt is more criminal than if he had carried an axe and demolished the holy Kaaba stone by stone," Mr Badie said.
Some analysts say the military could be preparing to move against sit-ins by Mr Morsi's supporters, including one in front of the Rabaa al-Adawiya mosque in a Cairo suburb.
Mohammed Morsi narrowly won the presidential election in June 2012 to become Egypt's first democratically elected president, but his opponents accused him of trying to impose an Islamist agenda on the country.
Interim President Adly Mansour has set out a "roadmap" towards a revision of the constitution introduced by Mr Morsi and for fresh elections in early 2014, but this has has been rejected by the Muslim Brotherhood.
Hisham Qandil, who was prime minister under Mr Morsi proposed his own roadmap on Thursday, involving:
* the release of those detained by the army since Mr Morsi's removal an independent investigation into the deaths of at least 51 people at the Presidential Guards HQ earlier this month
* a delegation to be allowed to visit Mr Morsi to check on his health a halt to protest marches, with both sides agreeing to hold rallies only in specific locations
* There has been no official response to Mr Qandil's suggestions, and military spokesmen have previously given the Muslim Brotherhood a deadline of Saturday to join the official process.
Meanwhile, the US government said on Thursday that it did not intend to declare formally whether a military coup occurred in Egypt or not.
This follows weeks of debate on how the US would describe the recent unrest in Egypt, which could have had repercussions on its supply of aid to the country which - under US law - must stop in the event of a coup.
The Obama administration is not legally bound to draw conclusions over recent events and to make such a declaration would not be in the US interest, Deputy Secretary of State William Burns told members of Congress.