Mr Trump issued a message on the social network Truth Social on June 16, not stating the reason, but quickly raising concerns about a major military outbreak in the Middle East - which has been like a " gunboat" since the opening of a series of airstrikes by Israel on June 13.
Everyone should leave Tehran immediately! Trump wrote in color print on Truth Social.
Tehran - Iran's most populous city with nearly 10 million people - is the key political, military and industrial center of the Islamic country.
Just hours after Trump's warning, Iranian state media reported that Tehran's air defense system had been activated. Several explosions were heard in the eastern part of the city.
The Israeli military has previously carried out a series of airstrikes targeting Iranian military and nuclear facilities, starting in the early morning of June 13. The strikes were described as "precise and deliberate," raising concerns about the collapse of all previous diplomatic efforts to curb Tehran's nuclear ambitions.

In a post on Truth Social, Mr. Trump emphasized: Iran should have signed the deal that I requested. What a pity, a terrible waste of life. I have said it again: Iran cannot have nuclear weapons!
A White House official said Trump's statement reflected the urgency of the situation and showed he wanted Iran to return to the negotiation table immediately.
Meanwhile, US Secretary of Defense Pete Hegseth confirmed on June 16 that he had ordered the deployment of additional forces and defense capabilities to the Middle East to protect US forces.
Washington's move comes as the USS Nimitz fleet is rushing to replace the USS Carl Vinson in the region, canceling the planned stop to move to the Middle East without delay.
From Canada, where the G7 Summit is taking place, Mr. Trump affirmed that he could reach a diplomatic agreement with Iran immediately after leaving the summit. Speaking to the G7 leaders, he said: I think Iran is basically at the negotiation table. They want to reach an agreement, and we will move on as soon as I leave here.
In Washington, JD Vance Vice President, Joint Chiefs of Staff Chairman Dan Caine and many national security advisers were seen urgently gathering in the White House early on June 16 (US time).
Analysts say Trump's warning is not only deterrent but also a signal that the US may be considering direct military action if tensions continue to escalate. It is not yet clear whether Mr Trump's evacuation call was based on specific intelligence information or was a pressure strategy to bring Iran back to the negotiation table.
Iran has not yet responded officially to Mr. Trump's statement. However, the Iranian news agency called the statement "occurrent intervention" and warned that "all military actions against Iran will be met with due retaliation."