"We must remove Islam's negative image from today's cyber and real space," he said in Tehran at an international conference on "The Islamic World's Current Crisis".
Saudi-led coalition: Pakistan won’t support moves against Syria or Iran, say officials
Most "violence, terror and massacres, unfortunately, take place in the Islamic world," he said.
"I invite all Islamic countries in this region and beyond - even those who until today have bombed and launched missiles on their neighbours - for all of us to stop this and choose the right path," he said.
Iran calls the new US visa law breach of the nuclear deal
He did not give any country names.
Shiite Iran supports Yemen's Huthi rebels, while its Sunni-ruled regional rival Saudi Arabia leads a military coalition that has been bombing them in support of the loyalists since March.
"How many bombs and missiles have you purchased from America this year?" he asked.
"If you had distributed the money for those bombs and missiles among poor Muslims, nobody would be going to bed hungry."
Tehran also backs the Syrian regime, whose army is fighting rebels and militants, including the Islamic State group that has taken over large swathes of the country and neighbouring Iraq.
"If some groups like Daesh can recruit soldiers, the reason is financial and cultural poverty," Rouhani said, using an Arabic acronym for Islamic State.
Both types of poverty should be eliminated from "Islamic society", he said. "Terrorism will not be destroyed by bombs."
Iraqi army prepares for final push to take Ramadi from Islamic State
"For years and years, we have talked of unity. Is unity possible without economic connections within the Islamic world," he asked.
The Syria and Iraq conflicts only benefit Israel and "those who are against Muslims", he said.
COMMENTS (12)
Comments are moderated and generally will be posted if they are on-topic and not abusive.
For more information, please see our Comments FAQ