"Our missiles are for our defence and for peace, they are not offensive. Know that while there is a technical need to conduct missile tests, we will do so and we will ask the permission of no one," Rouhani told reporters in Tehran.
His comments followed fierce critism from the US president during visits to Saudi Arabia and Israel.
"Iran must never be allowed to possess a nuclear weapon -- never ever -- and must cease its deadly funding, training and equipping of terrorists and militias," Trump said in Jerusalem.
"When they attacked Afghanistan, they made a mistake. When they attacked Iraq, they made a mistake. When they imposed sanctions on us, they made a mistake," he said.
More From This Section
"If you know of a case where America acted correctly, you tell me."
He said the only sensible move by Washington was the nuclear deal it signed with Iran in 2015, when the US "talked with respect" and reached a "win-win result".
"If American chooses another path, it will fail again. There is no doubt in this."
"We are waiting for this government to settle... I hope it can settle so that we can have a better judgement about those in Washington," said Rouhani.
Asked about Trump's summit with Arab leaders on Sunday, Rouhani said it was "just a show with no practical or political value of any kind".
In a jibe at the billion-dollar deals signed between Trump and the Saudi government, he said: "You can't solve terrorism just by giving your people's money to a superpower."
He added that it was Iran's allies in Lebanon, Syria and Iraq that had been leading the fight against the Islamic State group and other jihadists.
"The American people have not forgotten the blood spilt on September 11. They will not allow it to be traded for billions of dollars," he added, accusing the Saudis of promoting the extremism behind jihadist groups.
Focusing on the domestic situation at the start of his press conference, Rouhani criticised his hardline opponents for claiming they were the true keepers of the Islamic revolution.
"No one has the right to confiscate the revolution," said Rouhani, boosted by his election victory.
He made veiled criticisms at security agencies that control large swathes of the Iranian economy and have sought to block his efforts to privatise and attract foreign investment.
"The people know... That without competition on the basis of quality, not on the basis of political or security power, that our economy cannot progress," he said.