Speaking from the Oval Office on Tuesday, Haley said she had no "personal reasons" for leaving but felt someone else should take the role after she served eight "intense" years in South Carolina and at the UN.

Haley, 46, has represented the Trump administration at the UN amid several international crises, including efforts to dismantle North Korea's nuclear program and ease the bloody conflict in Syria. She has also criticized Iran after Trump pulled out of the Iran nuclear accord reached during the Obama administration.

Trump and Haley announced her exit plan on Tuesday morning — just under a month before the critical midterm elections on Nov. 6. The former South Carolina governor has served since January 2017, as the U.S. has deliberately scaled back its role in the international institution.

President Donald Trump meets with outgoing U.S. Ambassador to the United Nations Nikki Haley in the Oval Office of the White House, Tuesday, Oct. 9, 2018, in Washington.

Haley is only the latest high profile Trump foreign policy official to leave the administration. Secretary of State Rex Tillerson and two national security advisors, Michael Flynn and H.R. McMaster, all served only brief stints.

Haley has done an "incredible job" at the UN, Trump added, pointing specifically to efforts to denuclearize North Korea. Haley noted that she does not yet have plans for her next role but stressed she will not mount a Republican challenge to Trump in 2020. She said she "looks forward to supporting the president" in his re-election bid.

Haley told Trump about six months ago that she may need "a little time off," the president said. He did not immediately announce her successor, but said he has a number of people who want to take the job.

"I think it's just very important for government officials to know when to step aside," she said. She repeatedly thanked the president for choosing her to serve in the UN role and praised White House officials she worked with, including the president's daughter and son-in-law, Ivanka Trump and Jared Kushner.

Haley, who has criticized the president on some foreign policy points, wrote a column in September denying that she penned an explosive New York Times op-ed. In the Times piece, an anonymous "senior administration official" said people working for Trump have worked to undermine his worst impulses on issues such as trade and Russia policy.

"I, too, am a senior Trump administration official. I proudly serve in this administration, and I enthusiastically support most of its decisions and the direction it is taking the country," Haley wrote. "But I don't agree with the president on everything. When there is disagreement, there is a right way and a wrong way to address it. I pick up the phone and call him or meet with him in person."

Haley had her critics in the White House, and she scrapped back, as well. Top economic advisor Larry Kudlow had suggested she suffered from confusion earlier this year when she said new sanctions against Russia were coming. Haley responded by saying, "With all due respect, I don't get confused." Kudlow, in turn, apologized. But the incident apparently left a mark.

Javers tweet

Ethics groups recently requested an investigation into Haley over whether she inappropriately accepted flights from South Carolina businessmen. It was unclear if those ethics concerns related at all to her departure, and the White House did not comment on her reason for leaving.

Read Haley's full resignation letter to Trump below:

October 3, 2018 Dear Mr. President: It has been an immense honor to serve our country in your Administration. I cannot thank you enough for giving me this opportunity. You will recall that when you offered me the position of United States Ambassador to the United Nations in November 2016, I accepted the offer based on some conditions. Those conditions included serving in your Cabinet and on the National Security Council and being free to speak my mind on the issues of the day. You made those commitments and you have absolutely kept them all. For that too, I will always be grateful. We achieved great successes at the UN. We passed the toughest sanctions against any country in a generation, pressuring North Korea toward denuclearization. We passed an arms embargo on South Sudan that will help reduce violence and hopefully bring peace to that troubled country. We stood up for our ally Israel and began to roll back the UN's relentless bias against her. We reformed UN operations and saved over $1.3 billion. We spoke out resolutely against dictatorships in Iran, Syria, Venezuela, Cuba, and yes, Russia. Through it all, we stood strong for American values and interests, always placing America first. I am proud of our record. As a strong supporter of term limits, I have long believed that rotation in office benefits the public. Between the UN Ambassadorship and serving in the South Carolina Governorship and General Assembly, I have been in public office for fourteen straight years. As a businessman, I expect you will appreciate my sense that returning from government to the private sector is not a step down but a step up. Accordingly, I am resigning my position. To give you time to select a replacement, and to give the Senate time to consider your selection, I am prepared to continue to serve until January 2019. At that point, I will once again become a private citizen. I expect to continue to speak out from time to time on important public policy matters, but I will surely not be a candidate for any office in 2020. As a private citizen, I look forward to supporting your re-election as President, and supporting the policies that will continue to move our great country toward even greater heights. With best wishes and deep gratitude, Nikki Haley

-CNBC's Eamon Javers contributed to this report.