Obama said Ahmadinejad's chief rival, Mir Hussein Mousavi, had "captured the imagination" of Iranians.
Merkel, on her part, pledged an effort to identify the victims of violence of Iran, saying: "Iran cannot count on the world turning a blind eye."
Earlier on Friday, members of G8, the group of the world's largest economies, said at a conference in Italy that they "deplore" the post-election violence in Iran and urged the Islamic republic to "respect fundamental human rights".
Nuclear talks impact
Obama admitted that dialogue with Iran over its nuclear programme could be affected by the fallout from the elections.
"There is no doubt that any direct dialogue or diplomacy with Iran is going to be affected by the events of the last several weeks and we don't yet know how any potential dialogue will have been affected until we see what has happened inside of Iran," he said.
World powers have called on Iran to halt its nuclear programme amid fears that it could be used to develop nuclear weapons.
Iran insists that its nuclear activities are for peaceful purposes.
Ahmadinejad had compared Obama to his predecessor George Bush in an escalation of the war of words between Tehran and Washington.
"Why do you speak so impolitely with this great nation?" Mahmoud Ahmadinejad said at a petrochemical complex's inauguration ceremony in south Iran on Thursday.
He said in the speech broadcast on Iranian state television: "I hope you will avoid interfering in Iran's affairs.
"This is our friendly advice; we don't want to see the big disgraces of the Bush era to be repeated in the new US era."