He said the Syrian government "must read history and grasp its immortal message: It is the people who remain and those who put their personal interests before those of their people will inevitably go."
The summit's final statement also stressed support for a working group proposed by Morsi last year, made up of the leaders of Egypt, Turkey, Iran and Saudi Arabia to address the Syria crisis.
But Saudi Arabia only attended the quartet's first meeting several months ago and Saudi Crown Prince Salman, who was heading his country's delegation to the OIC summit, left Egypt just before the mini-summit was held Wednesday.
Egyptian officials insist that the Saudis have not pulled out, and an Egyptian presidential spokesman said Salman left because of other, personal engagements. The Saudi foreign minister stayed to attend the OIC summit.
But it is widely suspected that the kingdom has quit the group because they could not see the point of working with arch rival Iran, Assad's most ardent backer.
Ahmadinejad was asked to comment about the Saudi stance at his news conference in Cairo.
"We don't know why they left and we are not in a position to speak for them," he told reporters. "But, I am sure that our brothers in the kingdom (Saudi) will be happy and welcoming if we take positive steps toward a solution in Syria," he added.
Ahmadinejad said he was "alarmed by what Syria is going through" and called for dialogue.
"Egypt, Turkey and Iran are moving toward cooperation (on Syria) but no one has the right to interfere in the domestic affairs of others," he said. "Instead we must encourage a national dialogue there. War is not a good thing. War always breeds war," he added.
"Any government that comes to office through war cannot bring about a lasting peace. Only free elections and national dialogue can bring about security and a lasting peace."
The fighting in Damascus subsided significantly on Thursday, a day after the heaviest clashes in months.
Clashes were inching closer to the heart of the city, but still were focused in outlying neighborhoods such as Qaboun, Jobar and Zamalka in the northeast. Government troops beat back rebels who had tried to take over Jobar.
Fighters in rebellious suburbs of Damascus have made several attempts to overrun the heavily guarded center of the city, but failed. As in other parts of the country, the fighting has reached a stalemate.
"The work is being done here by us," said Iyad, the fighter who gave only his first name for security reasons. "The rest is just empty talk," he said of the calls for dialogue.
State-run television said rebels fired two mortar rounds at a bus station in the Qaboun neighborhood of Damascus, killing six people including three children and a woman. The TV, quoting an unnamed Interior Ministry official, said others were wounded in the attack.
The Observatory reported clashes and shelling between troops and rebels near Qaboun, saying several shells hit the neighborhood. It said the fighting occurred near the highway that links Damascus with the central city of Homs, Syria's third-largest.
In other areas, the Observatory reported heavy clashes between troops and rebels near the northern town of al-Safira, where there have been heavy clashes over the past weeks.
Al-Safira, south of the northern city of Aleppo, is home to military production facilities. The rebels have failed to advance in the area after weeks of intense clashes.
Karam reported from Beirut.