"(Ban) strongly condemns the mortar attack today on Camp Liberty, the temporary transit facility near Baghdad for former residents of Camp Ashraf," his press office said in a statement.
At least five people were killed and more than 25 wounded in the rocket attack, police sources said.
"The Secretary-General calls on the Government of Iraq, which is responsible for the safety and security of residents of both Camp Liberty and Camp Ashraf, to promptly and fully investigate the incident and bring perpetrators to justice," it said.
The Iranian dissident group Mujahadin-e-Khalq (MEK) said six people including a woman died after its camp was hit by mortars and missiles, while the U.N. mission in Iraq said it was aware of a number of deaths.
The MEK calls for the overthrow of Iran's clerical leaders and fought alongside the forces of former Sunni dictator Saddam Hussein in the Iran-Iraq war in the 1980s.
It is now seeking to recast itself as an Iranian opposition force but is no longer welcome in Iraq under the Shi'ite Muslim-led government that came to power after U.S.-led forces invaded and toppled Saddam in 2003.
The MEK has long criticized Ban's envoy in Iraq, Martin Kobler, accusing him of playing down problems with the group's facilities at their new temporary location at Camp Liberty. The United Nations has dismissed the criticism.
The statement said Ban "reiterates the United Nations' strong commitment to continue its longstanding efforts to facilitate a peaceful and durable solution for the residents of both Camp Liberty and Camp Ashraf."
In April 2011, 34 people were killed at Camp Ashraf, located in Diyala province, after Iraqi security forces moved against them, according to a U.N. investigation.
(Reporting By Louis Charbonneau; Editing by Doina Chiacu)