Mr Khan did not immediately leave the courtroom after the initial decision as the judges proceeded to deliberate whether to grant him bail in other corruption cases.
Former Pakistan prime minister Imran Khan has been released on bail for two weeks following a decision from the Islamabad High Court.
Mr Khan, who was the country's prime minister from 2018 to 2022, was back in court following his arrest on Tuesday on corruption charges.
His arrest sparked countrywide violence that left at least 10 people dead and dozens injured.
The country's Supreme Court ruled on Thursday the arrest was unlawful and ordered his release from custody, although Mr Khan spent the night as a police guest for his own protection.
It then asked the Islamabad High Court - a lower court - to reconsider its initial decision to uphold the arrest. The Supreme Court said it would respect Friday's ruling.
Mr Khan left the court hours after the decision was announced.
"They had no justification for my arrest, they abducted me," Mr Khan told The Independent.
"The first time they showed me an arrest warrant was inside the jail. It happens in the law of the jungle, the military abducted me. Where were the police? Where is the law? It's the law of the jungle. It seems there is martial law declared here."
Prime minister Shahbaz Sharif criticised the Supreme Court ruling on Friday, saying there was a "genuine corruption case" against Mr Khan, "but the judiciary has become a stone wall protecting him."
Mr Khan remained in the court after the decision as his lawyers petitioned judges for similar protection in a number of other corruption charges, trying to close off a legal avenue for the government to arrest him again.
The popular 70-year-old opposition leader was arrested earlier this week by the National Accountability Bureau in connection with corruption charges.
Pakistan's information minister, Marriyum Aurangzeb, defended the former professional cricketer's arrest.
She told Sky News: "A person who has defied court, who does not abide by the law, who avoid courts and who thinks he's untouchable and cannot be questioned, has to be treated the way every citizen is treated."
She rejected claims that there were political motives behind the arrest, as Mr Khan surfs a wave of popularity following an assassination attempt.
"If we wanted to arrest him or silence him because of his popularity, we would not have waited 14 months," she said.
Here’s What Happens If Your Cheque Bounces In Qatar
Apology after Philippines tourism video uses foreign footage
Apple Is Now Worth More Than $3 Trillion, Hitting New Market Cap Milestone
Man burns Holy Quran outside mosque during Eid al-Adha