Mr Hichilema was due to stand trial, but instead walked free from Lusaska’s high court after 100 days in custody.
Sources say the charges against Mr Hichilema and five aides were dropped after a deal was negotiated by the Commonwealth.
He narrowly lost the election to President Edgar Lungu last year.
Mr Hichilema, the leader of the United Party for National Development (UPND), alleges the vote was fixed, and does not recognise Mr Lungu as president.
Mr Lungu, meanwhile, faces accusations of growing authoritarianism.
Mr Hichilema was arrested in April, accused of endangering the president’s life after his motorcade allegedly refused to give way to the one transporting Mr Lungu.
He and his aides “strongly” denied the charge, which carries a sentence of at least 15 years. Those found guilty can also be sentenced to death.
But all charges have now been dropped, apparently after a visit by Commonwealth Secretary General Patricia Scotland, who was in Zambia last week and met Mr Lungu and Mr Hichilema.
She later hinted Mr Hichilema could be released in the public interest.
A source had earlier told the BBC he was “definitely being released today… unless there’s a last minute development”.
WATCH TOP VIDEOS FROM NIGERIAN TRIBUNE TV
- Let’s Talk About SELF-AWARENESS
- Is Your Confidence Mistaken for Pride? Let’s talk about it
- Is Etiquette About Perfection…Or Just Not Being Rude?
- Top Psychologist Reveal 3 Signs You’re Struggling With Imposter Syndrome
- Do You Pick Up Work-Related Calls at Midnight or Never? Let’s Talk About Boundaries