Anwar, once a leading light in the party that ruled Malaysia for decades, was jailed on sodomy charges in 2015, after a trial he says was politically motivated.
Mahathir had promised, if elected, to free Anwar and eventually hand power over to him.
At a news conference Friday, Mahathir said King Muhammad V had given his consent to a pardon. "It is going to be a full pardon, which of course means that he should not only be pardoned, he should be released immediately when he is pardoned," Mahathir told reporters, a day after being sworn in as Prime Minister. "After that he will be free to participate fully in politics."
Anwar remains imprisoned since the 2015 sodomy trial -- the second time he'd been jailed for the offense. He has long said the charges were an attempt to curb his political ascent.
Under current laws, Anwar's criminal record would bar him from political office for five years, but a royal pardon could pave the way for him to succeed Mahathir, who is 92.
Momentous vote
Mahathir was sworn in on Thursday night by the king, Malaysia's constitutional ruler, following a momentous vote in which scandal-plagued incumbent Najib Razak was soundly beaten at the polls by his former mentor.
Mahathir's victory upended six decades of control by the Barisan Nasional coalition, which he himself formerly headed as Malaysia's Prime Minister from 1981 until 2003.
Asked Thursday if he would pursue a corruption investigation into Najib, Mahathir said the former leader would be subject to the rule of law. The corruption scandal revolves around a state fund, known as the 1Malaysia Development Berhad, commonly known as 1MDB.
Addressing reporters Friday, Mahathir said his new government would reduce corruption to a minimum, state news agency Bernama reported. He also said the government was considering whether to look into the investigation into the 1MDB scandal carried out by the Malaysian Anti-Corruption Commission, Bernama said.
Anwar's wife, Wan Azizah Wan Ismail, endorsed Mahathir and served as his deputy in the coalition to oust Najib. She was one of the dozens of opposition candidates elected Wednesday.
Anwar was expected to be released in June, after serving the bulk of the sentence.
Longstanding rivalry
Mahathir and Anwar put aside a longstanding rivalry to fight together to defeat Najib and his United Malays National Organisation (UMNO) party, which forms the largest constituent in the Barisan Nasional coalition.
Anwar was the heir apparent to then-Prime Minister Mahathir until 1998, when he was fired and charged with corruption and sodomy. He spent six years in prison after being convicted of corruption charges in 1999 and of sodomy charges involving his wife's former driver in 2000.
Malaysia's highest court overturned the sodomy conviction and ordered him released from prison in 2004. However, the corruption verdict was never lifted, barring him from running for political posts until 2008.
Investigators arrested Anwar again in July 2008 over allegations that he sodomized his former aide, Saiful Bukhari Azlan.
The arrest came four months after a loose coalition of opposition parties led by Anwar won 82 of 222 parliamentary seats in elections.
CNN's Carly Walsh, Euan McKirdy, Marc Lourdes and Ushar Daniele contributed to this report.