"The pardons board has already met and the King has granted a full pardon, which means all past convictions have been expunged", lawyer Sivarasa Rasiah said.
The 92-year-old former autocrat Mahathir had headed the now-ousted Barisan Nasional regime for 22 years until 2003 but came out of retirement to lead a disparate opposition to an unexpected election victory.
"I am disappointed because I had hoped he could be prime minister as soon as possible", said Talib Ibrahim, an Anwar supporter outside the hospital.
Smiling and looking spry in a tailored black suit, Anwar emerged from a Kuala Lumpur hospital where he had undergone surgery for a shoulder problem, giving a thumbs-up to a crowd of journalists before leaving in a convoy of cars without making any public comment.
Anwar began serving a five-year jail sentence in February 2015 after the Malaysian federal court upheld his conviction and sentence on a charge of having sodomised a former personal aide.
He said after working with Dr Mahathir for many years, he understood that the former and now current Prime Minister cares deeply about Malaysia and the people of Malaysia.
Anwar was due to walk free on June 8, but the fast-tracking of his release - via an expected full royal pardon from Malaysia's King Muhammad V of Kelantan, due Wednesday - will allow him to re-enter politics nearly immediately, rather than waiting the five years required by the constitution.
'Big 6' pulling further clear in top-heavy Premier League
This saw City break the record set by Sir Alex Ferguson's side when they won the 1999/00 season 18 points clear of Arsenal . Pep Guardiola also deserve some praises for his tactical approach after a disappointing debut season at the Etihad Stadium.
Mahathir is the leader of the ruling alliance and Anwar's PKR won the majority of parliamentary seats in the group.
Malaysia's king has agreed to pardon him, paving the way for his return to politics.
The volatile relationship between Mahathir and Anwar has dominated Malaysia's political landscape for over three decades and is central to the future of the alliance. The pardon is necessary for Anwar to avoid a five-year ban on political activity.
He was jailed again in 2015, under the reign of Najib Razak.
Anwar can not directly join the government anytime soon.