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 Democratic Republic of Congo'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.
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.
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 spokesman 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.
British, French 'concern'
British Foreign Secretary William Hague and French Foreign Minister Laurent Fabius expressed their deep concern about the violence.
Olivier Hamuli, an army spokesman in Nord Kivu province, told local radio there had been "rough" fighting around the airport.
"Our concern is to avoid a bloodbath in the city," he said.
But Celestin Sibomana, a spokesman for the province, spoke of "a rout" in comments to AFP, and denounced what he said was the inaction of the UN peacekeepers.
Earlier on Sunday, an army intelligence colonel told AFP on condition of anonymity that fighting had reached a displaced people's camp in Kanyarucinya, 10 kilometres (six miles) from Goma.
"All the displaced have left the camp and are apparently now in the city of Goma," he said.
"We are trying to defend ourselves. We have hope in the new troops which are starting to arrive from Bukavu," the capital of the neighbouring province of South Kivu, he said.
EU foreign policy chief Catherine Ashton expressed the EU's concern for civilians caught up in the fighting, calling on all sides to give unrestricted access to aid workers.
But the M23 denied its forces had reached the camp.
The UN Security Council held an emergency session on the crisis on Saturday, demanding an end to the M23 advance and "that any and all outside support and supply of equipment to the M23 cease immediately".
It also vowed fresh sanctions against M23 leaders and those who help it breach UN sanctions and an arms embargo.
The fighting is the most serious since July, when UN helicopters last went into action against the M23.