McGahn had openly expressed his frustrations regarding his frayed relationship with the president and had signaled his desire to leave the White House months ago.
It is not unusual for White House counsels to come and go during an administration.
Trump announced McGahn's planned exit less than two weeks after The New York Times reported that the White House counsel had cooperated extensively with special counsel Robert Mueller as part of his investigation into Russian interference in the presidential election, including on the line of inquiry as to whether Trump obstructed justice.
Mr Trump made the announcement on Twitter, ending widespread speculation about Mr McGahn, who will be the latest in a long list of high-ranking advisers to leave Mr Trump's side.
Vanity Fair reported on Monday that McGahn refused to participate in the pardoning process and that Trump considered bringing on a new lawyer.
Minutes after Grassley's warning, however, the president fired off another tweet, again referring to Mueller's probe as a "witch hunt".
No. 1 Simona Halep Falls in First Round of U.S. Open
But Kanepi ended a 14-stroke exchange with a cross-court forehand volley victor to break right back, then served out the victory. But Kanepi completed the upset when Halep sent a service return long on match point. "Today I just lost", Halep told reporters.
There has been speculation the job would go to Emmett Flood, a veteran Washington lawyer who joined the White House in May to help with the Russian Federation probe, but Ms Sanders said he had not been offered the job.
McGahn once rejected a Trump order to fire Mueller, threatening to quit if the president did so.
McGahn put off making the call because he disagreed with the strategy, said the person, who spoke on condition of anonymity to describe internal deliberations.
And when Attorney General Jeff Sessions faced pressure to recuse himself, Trump enlisted McGahn to urge Sessions not to take that step.
McGahn was questioned by Mueller's team for 30 hours over the last nine months.
Before working at the White House, McGahn was a campaign finance attorney at Jones Day, a Washington law firm that has filled several top legal roles within the Trump administration. He specialized in campaign finance issues after serving on the Federal Election Commission from 2008 to 2013.