Williams, who has held the position since 2009, will continue in the position until a successor is found, according to a news release on Tuesday.
"For the past three years, we have executed on this important mission, while making fundamental changes to prepare housing finance for a better future," Williams said.
"As I told our employees today, I am extremely proud of what we have achieved together, and I am confident that they will continue to make a positive difference."
Fannie Mae and Freddie Mac were both brought under government control during the financial crisis in 2008.
Williams and his counterpart, Charles E. Haldeman Jr., the CEO of Freddie, came under fire for millions of dollars in bonuses paid to their employees during congressional testimony in November.
They argued that the sweeteners in the pay packages are necessary to help protect taxpayers from the losses that would result if Fannie and Freddie failed to retain their best workers.
"These are challenging jobs and challenging circumstances, and we need to reward the people willing to do them," Williams said.
He added that he has lost five senior vice presidents in the last three months to higher-paying jobs.
A day before that hearing, the House Financial Services Committee advanced a bill with bipartisan support that would overhaul how the government-sponsored enterprises (GSEs) pay their employees — including a provision that would place most of the workforce on the same pay scale as federal employees.
Edward DeMarco, the acting director of the FHFA, which regulates Fannie and Freddie, has said that the federal support — more than $150 billion worth — does not mean the GSEs are government entities.
"Fannie Mae and Freddie Mac employees are not government employees and these are not government agencies. They remain private corporations," he said in November.
DeMarco said his agency will work with the Fannie Mae board of directors in searching for a new CEO.