Police said they arrested Rina Randriamasinoro, the secretary general of the opposition Tiako I Madagasikara (TIM) party, and its national coordinator Jean-Claude Rakotonirina following tensions between demonstrators and security forces. The pair were later released.
"They were arrested and placed in police custody because they made comments inciting hatred and public unrest," Antananarivo's prefect Angelo Ravelonarivo told AFP.
Organizers had wanted to hold the rally inside a warehouse belonging to opposition leader Marc Ravalomanana, but demonstrators arrived to find security forces blocking access to the venue.
Protesters then staged a sit-in outside the building.
Footage shared on social media showed police pulling Randriamasinoro and Rakotonirina from the crowd before taking them away in a police pick-up.
"The rally was authorized yesterday by the prefect and then this morning we discovered the police outside the gate," said opposition lawmaker Fetra Ralambozafimbololona.
The arrests sparked further remonstrations, with demonstrators vowing not to leave the area until the two men were released -- before eventually dispersing in the afternoon.
Protests are rare in the country with the opposition and rights groups accusing the government of President Andry Rajoelina of stifling dissent and rarely allowing demonstrations.
"We can't say anything anymore," said Samuel Ravelarison, a 63-year-old accountant attending the rally.
"We came to demonstrate against the high cost of living."
One of the poorest nations in the world, Madagascar is still reeling from the economic effects of the coronavirus pandemic and a series of extreme weather events.
Rajoelina, 48, first came to power in 2009, ousting Ravalomanana with the backing of the military.
He returned to the presidency in 2019, after beating his predecessor in an election beset by allegations of fraud.