Trump was traveling with Perry in Texas, where the president would be attending a political rally in the evening. Trump said he already had Perry's replacement picked out.
"Three years is a long time," Trump told reporters of Perry's tenure as secretary.
He later added, "We have the man we're going to be putting in Rick's place and we’ll be announcing it very shortly."
Thursday evening, Perry posted a video on Twitter and wrote that it's "been the honor of a lifetime" serving as energy secretary under Trump.
Perry's resignation notice comes amid questions about his role in a White House effort to pressure Ukraine into launching an investigation that some conservatives thought would help Trump's re-election campaign.
Perry, who was Texas' longest serving governor and ran against Trump for president in 2016 before joining his administration, has not been accused of any wrongdoing. He also has insisted that actions he took regarding Ukraine were intended to advance U.S. interests in the region -- namely addressing government corruption and encouraging American companies to do business there.
In recent weeks, Perry has repeatedly knocked down suggestions that he planned to resign, including telling the Wall Street Journal in an interview published Wednesday that he planned to still be in the job on Thanksgiving.
In the interview, Perry also seemed to point the finger at Trump and his personal lawyer, Rudy Giuliani, for trying to press the newly installed Ukrainian government to conduct an investigation.
Giuliani said Ukraine had Democrat Hillary Clinton's email server and fabricated evidence that implicated former Trump campaign chairman Paul Manafort.
U.S. intelligence agencies have long said Russia, not Ukraine, tried to interfere in the 2016 election on behalf of Trump, not Clinton.
Manafort was sent to jail for tax and bank fraud on charges unrelated to the Trump campaign and tied to his political consulting work in Ukraine.
"I don't know whether that was crap or what," Perry told the Journal of Giuliani's call. "But I'm just saying there were three things that he said. That's the reason the president doesn't trust these guys."
Perry said in the interview that former Vice President Joe Biden never came up in his discussions with Trump, Giuliani or others. But in a July 25 phone call to Ukraine's president, Trump urges Ukrainian president to launch an investigation into the 2016 election and the role Biden's son played serving on a board of a Ukraine gas company.
Biden and his son, Hunter, have both said they did nothing wrong. In an interview with ABC News, Hunter acknowledged it was "poor judgement" to serve on an overseas board while his father as working as vice president but that there was no wrongdoing.
Perry's influential role in the region has led him to be described by U.S. Ambassador to the European Union Gordon Sondland and others as one of the "three amigos" tasked with overseeing the U.S.-Ukraine relationship.
That role in Ukraine also has made him a key person of interest for lawmakers seeking first-hand knowledge of events. He received a subpoena on Oct. 10; while some federal officials have testified under subpoena, other entities – the Defense Department, Office of Management and Budget, as well as Giuliani -- have declined to comply.
According to a report by The Associated Press, Perry allegedly tried to put at least one of his own previous campaign donors on the board of the Ukrainian gas company, Texas-based oil executive Michael Bleyzer, who donated $20,000 to Perry's gubernatorial re-election campaign in 2010. Another Texas oil man Robert Bensh's name, was also floated as a potential board member by Perry, according to the AP.
Perry later told reporters that he recommended knowledgeable people in the field for the position.
"We get asked for our recommendations about people who are experts in areas, various areas," Perry said. "Folks who have expertise in particular areas. Obviously having been the governor of the state of Texas, I know a lot of people in the energy industry."
Perry is the second cabinet member in a week to announce his resignation. Acting Homeland Security Secretary Kevin McAleenan resigned on Oct. 11 for reasons unrelated to the impeachment inquiry.
In his 2016 bid for the presidency, Perry said the Energy Department should be eliminated. After being named to head the post, he has used his role as secretary to expand the influence of American energy abroad, particularly in natural gas and nuclear technology. He has frequently said that being Energy secretary is the "coolest job in the world," while being governor of Texas was the best job.
ABC News' Sophie Tatum and Stephanie Ebbs contributed to this report.