At least 10 people died and 35 others were injured after a missile attack near the school, which was being used as a shelter, Palestinian officials said.
The school was housing nearly 3,000 internally displaced people in Rafah in southern Gaza.
Ban issued a statement Sunday "strongly" condemning the attack.
"The attack is yet another gross violation of international humanitarian law, which clearly requires protection by both parties of Palestinian civilians, U.N. staff and U.N. premises, among other civilian facilities," he said.
"United Nations shelters must be safe zones not combat zones," the statement continued. "The Israel Defense Forces have been repeatedly informed of the location of these sites. This attack, along with other breaches of international law, must be swiftly investigated and those responsible held accountable. It is a moral outrage and a criminal act."
Israel initially made no comment on the attack, but said it had targeted three members of the Palestinian Islamic Jihad, who were riding a motorcycle near the school. The IDF said it was reviewing the strike.
Ban called for another attempt at a cease-fire between Israel and Hamas. A three-day truce was announced and broken two hours later Friday morning.
"The Secretary-General repeats his demand to the parties to immediately end the fighting and return to the path of peace. This madness must stop," the statement said.