The bill was passed by parliament last week in retaliation for President Donald Trump's decision this month to designate Iran's elite Revolutionary Guards a foreign terrorist organization.
It was not clear what the impact of the new law might be on U.S. forces or their operations.
Rouhani instructed the ministry of intelligence, ministry of foreign affairs, the armed forces, and Iran's supreme national security council to implement the law, state media reported.
The law specifically labels as a terrorist organization the United States Central Command (CENTCOM), which is responsible for U.S. military operations in the Middle East and Afghanistan.
The United States has already blacklisted dozens of entities and people for affiliations with the Guards, but until Trump's decision not the organization as a whole.
Comprising an estimated 125,000-strong military with army, navy and air units, the Revolutionary Guards (IRGC) also command the Basij, a religious volunteer paramilitary force, and control Iran's ballistic missile programs. The Guards' overseas Quds forces have fought Iran's proxy wars in the region.
The long-tense relations between Tehran and Washington took a turn for the worse last May when Trump pulled out of a 2015 nuclear deal between Iran and six world powers, reached before he took office, and reimposed sanctions.
Revolutionary Guards commanders have repeatedly said that U.S. bases in the Middle East and U.S. aircraft carriers in the Gulf are within range of Iranian missiles.Rouhani said on Tuesday that Iran will continue to export oil despite U.S. sanctions aimed at reducing the country's crude shipments to zero.