He also praised the "resilience" of the Palestinian people and the "unwavering commitment" to independence of the president, Mahmoud Abbas.
In his first trip to the Palestinian territories, Mr Ban visited the Aida refugee camp on the outskirts of the biblical town of Bethlehem in the West Bank, just south of the Israeli wall.
He went on to the roof of a UN-run girls' school in the camp to take a look at the barrier, which in some sections, including the one near Aida, is made up of towering cement blocks. "No wall will stop us," read a piece of graffiti in English.
Mr Ban said: "I have deep admiration for these people, for the resilience of Palestinian people, to make their lives better.
"This has strengthened my resolve and commitment to work for peace in the Middle East."
Senior UN officials and Salah Tameri, the Palestinian governor of Bethlehem, explained to Mr Ban the difficulties caused by Israeli travel restrictions and the barrier.
Israel says it built the wall to keep out Palestinian militants who have killed hundreds of Israelis in bombing and shooting attacks in recent years. The Palestinians oppose the route of the barrier, which carves off some 10 per cent of the West Bank.
Mr Ban said it was "a very sad and tragic thing to see many suffering from the construction of this wall, depriving opportunities for basic living".
He was heavily guarded during the brief visit to the camp and constantly surrounded by bodyguards.
People living near the girls' school unfurled banners from their balconies, to remind him of the plight of the Palestinian refugees. "UN bodies and agencies should enable Palestinian refugees to exercise their right of return," read one sign in English, referring to people's demands to return to homes in what is now Israel.
Later Mr Ban showered praise on Mr Abbas, saying they shared a vision of a comprehensive peace deal with Israel. At a joint news conference with the Palestinian leader, following a meeting at Mr Abbas' headquarters in the West Bank, Mr Ban said: "You have shown an unwavering commitment to reaching self-determination and an independent state for the Palestinian people."
Such cordial remarks were not extended to the prime minister, Ismail Haniyeh, or to other Hamas party officials.
Hamas, branded a terrorist group by the United States and the European Union, joined Mr Abbas's more moderate Fatah party in a coalition government last week, but while Mr Ban welcomed the new government, he said "the atmosphere is not ripe" for talks with Hamas.
"At this time, I do not have plans to meet with prime minister Haniyeh or other Hamas cabinet ministers," he said.
Meanwhile, Condoleezza Rice, the US secretary of state, said she would try to revive the Israeli-Palestinian peace process by talking to both sides. She said she hoped to find a common agenda that would eventually lead to the creation of a Palestinian state.
The strategy appeared to set the stage for her to undertake shuttle diplomacy between Mr Abbas and Ehud Olmert, the Israeli prime minister.
Olmert accuses Abbas of breaking promise to free soldier
EHUD Olmert, Israel's prime minister, claimed yesterday that Mahmoud Abbas, the Palestinian president, had "blatantly violated" a promise to free a captive Israeli soldier before forming a new national unity government.
In an unusually blunt attack, Mr Olmert alleged that Mr Abbas had made the commitment "again and again" in meetings between the two leaders and also to "foreign heads of state".
But a senior Palestinian official said no such promise had been made.
Gilad Shalit was captured by Hamas-linked militants last June and it is believed he is being held in the Gaza Strip. His condition is unknown.
Mr Olmert said: "We can't ignore the fact that the chairman of the Palestinian Authority blatantly violated a series of commitments to Israel, especially the commitment that no national unity government would be formed before Gilad Shalit's release."
The Palestinian information minister, Mustafa Barghouti, denied that and said:
"I think Mr Olmert is misleading the world community and his own people."
He said Israel was responsible for the delay in Mr Shalit's release because it was not "dealing seriously" with Palestinian offers of a prisoner exchange.
Mr Abbas said: "We worked, are working and will work to release him."