Anwar Ibrahim, once considered a potential future leader, was jailed on charges of corruption and sodomy after falling out with the government.
But Mr Mahathir, the PM under which he was first jailed, just won an election on a pledge of freeing him.
He has indicated he will hand power to Anwar within a few years.
At a news conference on Friday - a day after his historic election win - Mr Mahathir said the king "has indicated he is willing to pardon Datuk Sri Anwar immediately", using a formal term of address.
"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. After that he will be free to participate fully in politics."