Trump sent a threatening message to Iran on twitter
Trump tweeted that Iran "will suffer consequences the likes of which few throughout
history have ever suffered before" if it threatened the US.
Mr Rouhani earlier said that war with Iran would be "the mother of all wars".
In May, the US left a deal which curbed Iran's nuclear activities in return for the lifting of international sanctions.
President Rouhani's comments, made to Iranian diplomats, did leave open the possibility of future good relations with the US.
"America should know that peace with Iran is the mother of all peace, and war with Iran is the mother of all wars," he said, according to Iran's state news agency Irna.
In a separate development on Sunday, US Secretary of State Mike Pompeo said the Iranian regime "resembles the mafia more than a government".
Addressing a group of Iranian Americans in California, Mr Pompeo denounced Mr Rouhani and Iranian Foreign Minister Javad Zarif, who negotiated the nuclear deal, as "merely polished front men for the ayatollahs' international con artistry".
Mr Pompeo said he wanted to try to stop countries importing Iranian oil by November as part of continued pressure on Tehran.
Mr Trump alleged that the deal did not restrict Iran's "destabilising activities" in the region enough, and could not detect or prevent any breaking of the terms of the deal.
Iran insists its nuclear programme is entirely peaceful, and its compliance with the deal has been verified by the International Atomic Energy Agency (IAEA), which has said Iran is honouring its commitments.
Trump's tweet appears to take the rhetoric expressed by Pompeo a step further.
The
tweet, which is likely to be construed as a threat of war among
Tehran's hardliners, has echoes of Trump's "fire and fury."
The
now-infamous threat came as North Korea continued to test-fire
ballistic missiles, including two that demonstrated a long enough range
to potentially reach the United States.