Iran blocked Telegram - widely used by Iranians, the state media, politicians and companies - earlier this week to protect national security, state television said, weeks after a similar move by Russia.
Iran had been considering the ban since January when protests over economic grievances erupted in more than 80 cities and later turned into demonstrations against the clerical and security elite.
Some officials said protesters used Telegram to organise rallies, which were ultimately contained by the Revolutionary Guards and their affiliated volunteer Basij militia. The app was temporarily blocked in January.
"Failure to follow legal procedures and the use of force and judicial means is ... the opposite of democracy," Rouhani, a pragmatic cleric who has advocated expanding social freedoms, said in an Instagram post late on Friday.
Rouhani's powers are dwarfed by those of Supreme Leader Ayatollah Ali Khamenei who is close to conservatives and hardliners.
Iran's Shi'ite Muslim clerical rulers are wary of any revival of anti-government unrest should President Donald Trump refuse to extend U.S. sanctions relief on Iran on May 12, a deadline he set for European signatories of Iran's 2015 nuclear deal with six world powers to "fix flaws" in the accord.
Government filtering prevents Iranians from accessing many internet sites on the official grounds that they are offensive or criminal. But many Iranians evade the filtering through the use of VPN software, which provides encrypted links directly to private networks abroad, and can allow a computer to behave as if it is based in another country.
Get the latest election news, live updates and election schedule for Lok Sabha Elections 2019 on ndtv.com/elections. Like us on Facebook or follow us on Twitter and Instagram for updates from each of the 543 parliamentary seats for the 2019 Indian general elections.