According to the state TV report, President Rouhani said both Iran and Russia would work in "extensive cooperation" to prevent any military action against Syria. Rouhani also called such military action an "open violation" of international laws.
While condemning chemical weapons, Rouhani was quoted as saying, "Early judgment can be dangerous, before clarification" can be made of allegations that Syria used the weapons.
"Western countries have found some excuse to prepare the ground to weaken the stance of Syria in further talks" after the Syrian government has won the upper hand in confronting rebels, Rouhani said.
The president also predicted regional consequences for any military strike.
"Syria has a strategic and sensitive situation, and any sort of military invasion would lead to instability in the entire Middle East," he said.
Iran has regularly warned the U.S. over possible military action against Syria by calling it the country's own "red line" as the U.S. naval fleet takes positions near Syria and President Barack Obama considers a military response to the alleged use of chemical weapons by the Assad government.
Hossein Naghavi, spokesman of Iran's parliamentary committee on national security and foreign policy, told the semi-official Fars news agency Thursday that an Iranian parliamentary delegation will visit Syria Saturday to study developments and to express support for its people and government.
Assad is Iran's main Middle East ally, and his downfall would deal a serious blow to Iran and its proxy forces, Hezbollah in Lebanon and Palestinian Hamas. Iran does not recognize Israel.
In a Cabinet meeting earlier on Wednesday, Rouhani strongly condemned the use of chemical weapons.
"Iran, as a major victim of chemical weapons, is a pioneer in fighting any kind of inhuman weapons at the global level, and it strongly condemns any use of this weapon," he said, according to the president's website.
Rouhani called for the U.N. to investigate both sides of the Syrian conflict.
"The U.N should probe the use of chemical weapons while regarding field realities, handmade weapons that were used and the history of transferring chemical weapons to Takfiri groups from abroad," said Rouhani, using the general term for Muslims who accuse others of being unbelievers.