Citing his “critical health condition,” judge Fernando Antonio De Almeida said the 71-year-old should no longer be kept at the high-security Bangu 10 jail.
“I do not see that his freedom will present any risk to public order, criminal investigation or, if appropriate, the future application of criminal law,” he said.
Mr Hickey will be released once the court order, which was issued last night, is forwarded to prison authorities.
Under the order, Mr Hickey will not be allowed to leave Brazil and will have to surrender his passport to the authorities within 24 hours.
The judge accepted the request of the Irishman’s lawyers who went to an appeal court in Rio de Janeiro after initially being denied habeas corpus.
The judge added that, even if Mr Hickey was convicted, he would not serve his sentence at a high-security jail as none of the three offences have a term of more than four years.
Mr Hickey is accused of facilitating touting, which carries a sentence of two to four years, forming a criminal cartel, which has a sentence of between one and three years, and illicit marketing, which carries a sentence of six months to one year.
On Saturday another arrested Irishman, Kevin James Mallon, 36, was released from Bangu, where he shared a cell with Hickey, after a federal court order.
An executive of THG Sports, the company accused of being at the heart of the alleged €3m touting ring, he was arrested on August 5, as the Olympics opened, with 823 tickets in his possession.
Yesterday, Mr Mallon attended a court in Rio de Janeiro, as prescribed by his bail conditions issued by the Superior Court of Justice in Brasilia.