He and Merkel had sent a joint message of condolence to the families of those killed in the Monday attack during a concert.
"We can see the terrible violence that took place just recently in Manchester... it's a reminder that there is great danger of terrorism and people who would do great harm to others just because they're different," Obama told a crowd at the German capital's Brandenburg Gate.
He and Merkel had sent a joint message of condolence to the families of those killed in the Monday attack during a concert by US pop star Ariana Grande, he added.
"We had a chance backstage to send a message to the people of Manchester about how heartbroken we are by the loss of life," Obama said.
Some 70,000 people had gathered at the central Berlin landmark to see Obama reunited with Merkel for the Evangelical Church's biennial gathering, German public television reported.
The 44th President offered a valuable boost to Merkel ahead of parliamentary elections in September, labelling her "one of my favourite partners throughout my presidency".
"Chancellor Merkel has done outstanding work, not just here in Germany but around the world," he said.
Over 90 minutes, the pair faced questions about the importance of their Christian faith to their politics from church leaders and young people from Germany and Chicago, including on tough moral issues such as lethal drone strikes and the deaths of migrants and refugees attempting to cross the Mediterranean to Europe.
Obama is set to travel to Baden-Baden, southwest Germany, later Thursday to accept the German Media Prize.