The Chinese-owned firm has been accused of being a threat to US national security by the Trump administration.
Mr Mayer joined TikTok in June after leaving his role as Disney's head of streaming services.
TikTok was given 90 days to be sold to an American firm or face a ban in the US.
"In recent weeks, as the political environment has sharply changed, I have done significant reflection on what the corporate structural changes will require, and what it means for the global role I signed up for," Mr Mayer said in a letter to employees.
"Against this backdrop, and as we expect to reach a resolution very soon, it is with a heavy heart that I wanted to let you all know that I have decided to leave the company," Mr Mayer added.
Both TikTok and Chinese messaging app WeChat face bans in the US as tensions rise between Washington and Beijing over a wide range of issues including national security concerns about Chinese tech firms.
"We appreciate that the political dynamics of the last few months have significantly changed what the scope of Kevin's role would be going forward, and fully respect his decision. We thank him for his time at the company and wish him well," a spokesman for TikTok said.
Kevin Mayer was brought into TikTok to help give the Chinese-owned app an American image.
The thinking was that the former Disney man would be able to negotiate with a tough-on-China Trump administration better than perhaps a Chinese chief executive and that would help smooth TikTok's path into one of its biggest markets - the US.
Instead, the intense pressure from the Trump administration on TikTok only grew.
President Trump claims TikTok is a national security threat because of who it is owned by, Chinese internet firm ByteDance.
Earlier this month, he signed an executive order that would effectively ban TikTok's operations in the US if it wasn't sold to another company by mid September.
All of this is not what Mr Mayer signed up for when he left Walt Disney to take on the role at TikTok.
And after just two months in the job, he is now departing.