Government troops and local officials were already fleeing the city, said several sources.
The M23 rebels, army mutineers whose uprising in April has unleashed fresh unrest in the DRC's chronically unstable east, are now near the airport of Goma, the main city in the mineral-rich region.
The UN warned there was a "real threat" that Goma would fall. Rebels had already warned that they would seize the city if they came under attack from the army.
But Ban said the UN troops "will remain present in Goma and will continue all efforts to robustly implement its mandate to the fullest of its capabilities with regard to the protection of civilians".
The UN chief "emphasises that any actions to undermine or target Monusco [the UN mission] will not be tolerated", according to a statement released by his office.
The United Nations has about 6 700 troops in Nord Kivu province, backing government forces against rebels who have moved to the edge of Goma in recent days. About 1 500 of them are in Goma.
The UN attack helicopters have staged cannon and rocket strikes against the rebels but have not been able to stop the steady advance towards the capital of Nord Kivu, a key mineral producing region.
Extremely tense situation
Innocent Kayina, M23 operations commander for the area, told AFP: "If the FARDC [government forces] attack us, we will take the city".
Government troops said they were trying to avoid a "bloodbath" in the area.
In New York, UN peacekeeping spokesperson Kieran Dwyer told AFP that UN forces were supporting government troops in the region by firing cannon and rockets at the rebels, after similar action on Saturday.
"The situation in Goma is extremely tense. There is a real threat that the city could fall into the M23's hands," said Dwyer.
About 625 UN expatriate workers had gathered at special protection points across the city, he added. UN peacekeepers in 17 "quick reaction units" had been deployed across Goma.
After a three-month truce, fighting in the region resumed on Thursday, just two days after the United Nations and the United States imposed sanctions on the leader of the M23 group.
The rebels are ethnic Tutsi former soldiers who mutinied in April after the failure of a 2009 peace deal that integrated them into the regular army.
UN experts have said Rwanda and Uganda back the rebels, a charge fiercely denied by both countries.
The EU joined the UN in calling on the rebels to halt their advance.