Ismail Omar, the national deputy police chief, said in a statement the attorney-general's office had decided to charge Anwar after police "completed their investigation into a criminal sex case involving intercourse against the laws of nature".
Sodomy is illegal in Malaysia even among consenting adults, and a conviction could see Anwar jailed up to 20 years.
Anwar has denied the sodomy allegations saying they were aimed at derailing his political comeback.
After receiving the order on Wednesday Anwar said he holds Abdullah Ahmad Badawi, the Malaysian prime minister, personally responsible for the move, accusing him of trying to staging "a sham trial" to deflect public attention from national problems.
The news came as Anwar prepared to contest in a by-election for a parliamentary seat vacated last week by his wife, Wan Azizah Wan Ismail, who is also Keadilan president.
Hours earlier the Election Commission fixed August 26 for the by-election in Permatang Pauh in the northern state of Penang, where Anwar was MP before his sacking from office on charges of corruption and sodomy in 1998.
The commission announced that nominations can be filed 10 days before polling day, and urged both sides to "obey the instructions of the security officials to safeguard public safety and security".
Despite being formally charged Anwar can still contest the seat but he could be prevented from campaigning if the court refuses to release him on bail pending a trial.
The sexual abuse allegation surfaced last month as Anwar, the former deputy prime minister, stepped up his campaign to return to parliament.
A 23-year-old male aide claimed Anwar had sexually assaulted him in June but Anwar insists the allegation was fabricated to thwart his plan of seizing power
from the government by mid-September.
The government denies a conspiracy.