The royal pardon potentially paves the way for him to succeed the country's elderly new leader Mahathir Mohamad, who was the surprise victor over former Prime Minister Najib Razak in last week's parliamentary election.
Surrounded by media and supporters, Anwar walked out of a hospital Wednesday where he was recovering from surgery. Anwar had been serving a five-year prison sentence for sodomy charges he says were politically motivated. Until his early release, he had been scheduled to be freed in early June.
The politician, a voice for reform in Malaysia and once a leading light in the party that ruled Malaysia until last week's election, was jailed in 2015. It was the second time he had been convicted of a sodomy offense.
Mahathir, 92, and Anwar, 70, had put aside a longstanding rivalry to fight together to defeat Najib. Anwar's wife, Wan Azizah Wan Ismail, endorsed Mahathir and served as his deputy in the coalition to oust Najib.
Mahathir and Anwar are a political odd couple who have "hated each other politically" for two decades, James Chin, Director of the Asia Institute at the University of Tasmania, told CNN ahead of the election last week.
However, the Malaysian public saw the two politicians' "rapprochement as something very good," Chin said, and together they toppled Najib and broke the ruling coalition's 60-year grip on the country.
Mahathir Mohamad: Malaysia's comeback prime minister
'Impatient' to get back into politics
The partnership between Mahathir and Anwar was plotted last year, when a new leadership structure for the then opposition was announced, with Anwar its de facto leader and Mahathir named the four-party coalition's chairman.
Anwar is thought to be "impatient to get back into office," but Mahathir won't step down until he's ready, Meredith Weiss, professor of Political Science at the University at Albany, says, adding that there's "nothing Anwar can do" to hurry along the process.
"Mahathir is not known for standing down. He stepped aside in 2003 but continued meddling (from the sidelines)."
Having Anwar and ready to return to active politics "brings stability to the transition," and Weiss suggests that Mahathir may stay in place until a corruption investigation into Najib is underway and the reform process touted in his electioneering begins.
She says that Anwar's recent hospitalization might "encourage him to slow down a bit," but he is known to be eager to get back into the fray.
Anwar still needs to be elected as a member of parliament, and it was assumed that his wife would stand down from the seat she won last week, says Weiss.
However, she's demonstrated she has a great deal of public support so another legislator might have to step down to allow Anwar to run, she added.
Anwar made his name as a student activist in various Muslim youth groups in Kuala Lumpur in the late 1960s, as the country reeled from the protracted Communist insurgency of the Malayan Emergency.
Arrested in 1974 in student protests against rural poverty, Anwar was sentenced to 20 months in jail. Despite his firebrand reputation, he later confounded liberal supporters in 1982 by joining the conservative United Malays National Organization (UMNO) led by Mahathir.
The freed politician was the heir apparent to then-premier Mahathir until 1998, when he was sacked and charged for corruption and sodomy. He was found guilty the following year, a ruling that led to mass street demonstrations.
The sodomy conviction was overturned, but the corruption verdict was never lifted, barring him from running for political post until a decade later.
In 2008, once his ban on political participation was lifted, he was hit with further sodomy charges.
Following an appeal of the acquittal of those charges he was convicted again and jailed in 2015. Human rights groups were highly critical when the conviction was upheld, calling it politically motivated -- a claim the government denied.