In a filing authorising the arrest, Justice Moraes said information from the centre monitoring Bolsonaro’s house arrest suggested the former president’s “intention to break the electronic ankle bracelet to ensure success in his escape”.
This, it said, would be “facilitated by the confusion caused by the demonstration called by his son”.
Flávio Bolsonaro, who serves a senator, called for a gathering of his supporters near his father’s home to take place on Saturday night.
The senator wrote on social media on Friday: “Are you going to fight for your country, or watch it all from your phone there on your sofa? I invite you to fight with us.”
He said the vigil would enable supporters to “pray for his health and for the return of democracy in our country”.
To explain his decision, Justice Moraes cited the possibility of Bolsonaro fleeing to foreign embassies, citing “a history of planning to request asylum through a diplomatic representation”.
The court filing notes that the US embassy in the capital, Brasilia, is located about 13km (8 miles) from Bolsonaro’s home.
Bolsonaro’s legal woes have drawn the ire of fellow right-wing populist US President Donald Trump, prompting him to impose a 50% tariff on imports of Brazilian goods.
Bolsonaro is being held in a police station in Brasilia and will undergo a custody hearing on Sunday.