Rouhani's comments at a military event will add to the rising tensions between Tehran and Washington over the Islamic Republic's regional policies.
At the annual United Nations General Assembly on Tuesday, Trump accused Iran of building "dangerous" missiles and exporting violence to Yemen, Syria and other parts of the region.
He also criticized the 2015 pact struck by Iran and six major world powers under which Tehran agreed to restrict its nuclear program in return for loosening economic sanctions.
In a defiant speech in the capital Tehran, addressing a parade of armed forces, Rouhani said Iran will not stop boosting its military forces.
"We will increase our military power as a deterrent. We will strengthen our missile capabilities ... We will not seek permission from anyone to defend our country," Rouhani said in a speech broadcast on state television.
"All countries in the world supported the nuclear deal in the United Nations General Assembly this year… except the United States and the Zionist regime (Israel)," Rouhani said.
US Secretary of State Rex Tillerson has said that the agreement must be changed or the United States could not stick with it.
Iran has said its nuclear accord cannot be renegotiated.
The prospect of Washington reneging on the deal has worried some of the US allies that helped negotiate it, especially as the world grapples with North Korea’s nuclear and ballistic missile development.
Chinese Foreign Minister Wang Yi said the recent tension on the Korean peninsula underlined the importance of the Iranian deal, and that China would continue to support and safeguard itRussian Foreign Minister Sergei Lavrov said on Thursday that US unilateral sanctions on Iran are "illegitimate and undermines the collective nature of international efforts."