"This morning a UN school sheltering thousands of Palestinian families suffered a reprehensible attack," Ban said during a visit to Costa Rica on Wednesday.
"It is unjustifiable, and demands accountability and justice."
The school in the Jabaliya refugee camp in northern Gaza, which was sheltering more than 3,000 homeless people, came under attack from Israeli tank shells at dawn Wednesday.
It is the second time in a week that a UN school housing refugees has been hit.
Ban accused the Israeli military of ignoring repeated communications on the location of the school.
"I want to make it clear that the exact location of this elementary school has been communicated to the Israeli military authorities 17 times, as recently as last night, just a few hours before this attack," he said.
"They are aware of the coordinates and exact location of where these people are."
Costa Rican President Luis Guillermo Solis meanwhile joined international calls for an end to the bloodshed.
"We want the immediate establishment of a UN-monitored ceasefire to enable an escape from this bloody vortex, which is an offense to humanity," he said.
HH/HH