Obama and Merkel met in Berlin in front of a massive crowd at the biennial congress of the German Protestant Church, on a day when the German Chancellor will also greet current US President Donald Trump, who is the epitome of many of the political trends they abhor.
Obama, in the first event overseas linked to his new global foundation, and his host, beseeched young people not to give up on the idea that politics could forge meaningful change, though both ruefully reflected that campaign trail promises often were not fully realized once in power.
And, in a nod to the uneven boons of globalization that have divided societies and enabled the rise of outsider nationalist candidates in the US and in Europe, they said more needed to be done for those who have been left behind.
Obama did not mention Trump directly or weigh in on any of his specific policies, in keeping with his desire not to get pulled into a political confrontation with his successor.
But many of his remarks on immigration, health care, foreign aid, the economy, education, threats to the international order and to human rights clearly spelled out a worldview that is at odds with that of the current president.
And the fact that many thousands of young Germans turned out to applaud him was testimony to the former president's enduring appeal in parts of Europe, where the Trump presidency is being viewed with dread.
Obama and Merkel had a conversation about democracy, civic engagement and faith a few yards away from the place where the Berlin Wall wound around the Brandenburg Gate as it divided the city between 1961 and 1989. Merkel held up her own experience growing up in the East to show how even great political change is possible.
The former US leader, who counts Merkel as among his closest political friends and allies, warned that "progress" towards universal health care made during his presidency was in peril as Republicans try to repeal his signature domestic achievement.
"My hope was that I was able to get 100% of people health care while I was president. We didn't quite achieve that, but we were able to get 20 million people health care who didn't have health care," he said.
"Certainly, I have some regrets," he said, adding that he had hoped to do more.
"Obviously some of the progress that we made is now in peril ... but the point really is for those 20 million people, their lives have been better," Obama said. "We have set a standard that people can build on."
Obama was appearing at the biennial congress of the German Protestant Church.
Thousands of people crowded in front of the Brandenburg Gate and down the green space known as the Tiergarten to see Obama and Merkel in a scene reminiscent of his 2008 campaign speech that he delivered at the Victory Column monument nearby.
Snipers took up positions on the rooftops overlooking the iconic Berlin landmark amid a tight security operation just a few days after a suicide bombing in Manchester, England.
Obama also addressed the question of refugees -- hundreds of thousands of which have flowed into Germany from the Middle East and undocumented migrants, a key issue in the last US election that still roils American politics.
He said that as President he had faced a dilemma.
"In the eyes of God, a child on the other side of the border is no less worthy of love and compassion than my own child," Obama said. "You can't distinguish between them in terms of their worth or inherent dignity."
"We can't isolate ourselves. We can't hide behind a wall," Obama said, in what will be seen as an oblique reference to the southern border wall Trump is insisting he will build.
Obama also spoke out strongly against what he said was xenophobia and nationalism that have been simmering in modern politics, warning, "we have to push back against those trends that would violate human rights or that would suppress democracy."
The former president praised foreign aid funding, saying it was vital to eventually alleviating the need to take military action in unstable areas of the world. Again, he was adopting a position at odds with that taken by Trump, whose first budget cuts foreign aid and hikes investments in the military.
Merkel, who will encounter Trump later on Thursday at the NATO summit in Brussels, discussed how political change can sometimes come about more slowly than people wanted but said that it required perseverance over a period of years to get things done.
"For decades maybe, people laughed about there won't be a German reunification -- but it happened," Merkel said.
Merkel also referenced the need to spread the benefits of globalized economics more evenly. The success of populist politicians like Trump and the runner-up in the French election, Marine Le Pen, exploited a feeling that urban elites were profiting from the interlinked global economy while blue collar voters had been left behind.
"We will only be able to live in a good and peaceful society if everyone is doing well. That is what we mean when we say inclusive growth and we have to understand this and invest in this," Merkel said.
Obama concurred: "One of the major questions that this generation and future generations will have to face s the growing gap in opportunity and increasingly inequality that we are seeing between nations and within nations."