"If deliberate, this attack may amount to a war crime," Ban said in a statement from his spokesman.
The Syrian Observatory for Human Rights said "warplanes -- either Russia or Syrian -- carried out six strikes" on Wednesday in a village in rebel-held Idlib province, including on a school complex.
UNICEF said the school compound in the village of Hass was "repeatedly attacked," leaving 22 children and six teachers dead.
Ban called for an "immediate and impartial investigation" and raised concerns about a series of attacks on civilian targets in Syria, now in its sixth year of war.
Signup to our newsletter and follow us on Facebook and Twitter!
"If such horrific acts persist despite global outrage, it is largely because their authors, whether in corridors of power or in insurgent redoubts, do not fear justice," he said.
"They must be proved wrong."
Russia, which is backing Syria in its military operations against opposition rebels and jihadists, said it had nothing to do with the air strikes and also demanded an immediate investigation.
Former British prime minister Gordon Brown, who is the UN envoy for global education, earlier called on the Security Council to ask the ICC prosecutor to open up an investigation of the attack, describing it as a war crime.
Russia used its veto in 2014 to block a resolution demanding that the ICC investigate war crimes in Syria.