"I was shocked to see how these refugees and migrants were treated. It's not acceptable," Ban told a news conference in response to a question about the border clashes.
The UN chief stressed that "these were people fleeing war and persecution" and that the response must be one of "compassionate leadership."
"We must show them caring hands," he said. "They must be treated with human dignity."
On Wednesday, Hungarian police clashed for hours with hundreds of migrants after the government sealed its southern border with Serbia, one of the biggest entry points into the European Union.
More From This Section
Children were crying from the effects of the tear gas and several ambulances were dispatched to the border crossing, according to AFP reporters at the scene.
The United Nations has made repeated appeals to European leaders to uphold human rights as the continent grapples with its worst migration crisis since World War II.
Europe's migration crisis is expected to loom large over this year's gathering of world leaders at the United Nations, which kicks off on September 25 with an address by Pope Francis.
The secretary-general praised Lebanon, Jordan and Turkey for taking in millions of refugees from the war in Syria, which is now in its fifth year.