With tensions rising, Trump tweeted on Sunday: "If Iran wants to fight, that will be the official end of Iran."
But Zarif said the US president should look at history. "Iranians have stood tall for millennia while aggressors all gone... Try respect - it works!"
Writing on Twitter on Monday, Iran's foreign minister said the US president was being "goaded" by what he called the "B Team" - a reference to US National Security Adviser John Bolton, Israeli Prime Minister Benjamin Netanyahu, and Saudi Crown Prince Mohammad bin Salman.
Trump "hopes to achieve what Alexander [the Great], Genghis [Khan] & other aggressors failed to do. Iranians have stood tall for millennia while aggressors all gone. #EconomicTerrorism & genocidal taunts won't 'end Iran'," he added.
"#NeverThreatenAnIranian. Try respect - it works!"
The US has deployed additional warships and planes to the Gulf in recent days.
But Trump's tweet marked a shift in tone after recent attempts by him to downplay the possibility of a military conflict with Iran. When asked by reporters on Thursday if the US was going to war, he said: "I hope not."
His warning to Iran on Sunday was issued hours after a rocket was fired into the heavily fortified Green Zone in the Iraqi capital, Baghdad, and hit a building about 0.5km from the US embassy.
The US recently evacuated non-emergency staff from the mission because of what it called a "serious" threat reportedly linked to Iran-backed forces in Iraq.
The White House also announced that the US was sending an aircraft carrier, B-52 bombers and a Patriot missile defence battery to the region because of "troubling and escalatory indications" related to Iran.
Last week, four oil tankers in the Gulf of Oman were damaged in what the UAE said were sabotage attacks, and drone attacks on two oil pumping stations in Saudi Arabia by Yemen's Houthi rebels forced the temporary closure of a pipeline.
Iran has denied that it was behind two incidents.
There were also unconfirmed reports, citing US and regional security officials, that Iran had loaded missiles onto boats in Iranian ports and that Iran-backed Iraqi paramilitary fighters had positioned rockets near facilities in Iraq used by US troops.
"I would say to the Iranians: do not underestimate the resolve on the US side," UK Foreign Secretary Jeremy Hunt told reporters in Geneva on Monday. "They don't want a war with Iran. But if American interests are attacked, they will retaliate."
"We want the situation to de-escalate, because this is a part of the world where things can get triggered accidentally," he added.
Saudi Minister of State for Foreign Affairs, Adel al-Jubeir, said the kingdom "does not want a war, is not looking for it and will do everything to prevent it".
"But at the same time, if the other side chooses war, the kingdom will respond with strength and determination to defend itself and its interests."
The foreign minister of Oman, which has brokered secret talks between the US and Iran in the past, visited Tehran to discuss regional issues with Zarif on Monday.