TEHRAN — One of Iran’s most prominent opposition leaders, under house arrest since 2011, was hospitalized early Thursday, a day after he began a hunger strike to demand a public trial, family members said.

The release of the opposition leader, Mehdi Karroubi, and another former presidential candidate under house arrest, Mir Hossein Mousavi, was a major demand by supporters of President Hassan Rouhani during his re-election campaign. They shouted slogans in support of the two men during every campaign rally in May.

The protest by Mr. Karroubi, 79, who has been hospitalized several other times in recent months for heart problems, places Mr. Rouhani in a difficult position, as he has long vowed to get the two men released.

It is widely thought that Iran’s supreme leader, Ayatollah Ali Khamenei, opposes their release and objects to a trial. The two men have never been formally charged.