In remarks carried by Iranian media on Friday, Rouhani said "violence and terrorism is reprehensible whether in this region, in Europe or in the United States".
"Those who kill and carry out violent and extremist acts unjustly in the name of jihad, religion or Islam provoke Islamophobia whether they wish it or not," said Rouhani.
Rouhani appeared to be alluding to Wednesday's attack in Paris, where gunmen massacred 12 people, including eight journalists, at the headquarters of the satirical weekly Charlie Hebdo.
Signup to our newsletter and follow us on Facebook and Twitter!
But he did not mention by name the magazine, where masked gunmen shouting "Allahu Akbar" (God is greatest) carried out the massacre saying they wanted to avenge the Prophet Mohammed.
Charlie Hebdo was known for lampooning radical Islam and had angered Muslims on several occasions, particularly when it published in 2006 cartoons depicting the prophet, including one which showed a turban as a bomb.
Iran condemned the attack on Wednesday, with foreign ministry spokeswoman Marzieh Afkham saying "all acts of terrorism against innocent people are alien to the doctrine and teachings of Islam."
Imam Ahmad Khatami, the key leader of Friday prayers, reiterated that view in his weekly sermon.
"Islam does not allow the killing of innocents, be it in Paris, Syria, Iraq, Yemen, Pakistan or Afghanistan," he said, adding he "vigorously condemns" the Paris carnage.