WASHINGTON—President Donald Trump said Wednesday he was willing to testify under oath in special counsel Robert Mueller’s investigation into Russia’s interference in the 2016 election, the latest twist in a probe that he has repeatedly denounced as a “witch hunt.”

Mr. Trump’s statement was more emphatic than his answer to the same question at a news conference two weeks ago, when he said of a possible appearance before Mr. Mueller, “we’ll see what happens,” though he also noted Wednesday that any decision is “subject to my lawyers.”

Mr. Trump spoke with reporters as he prepared to leave for Davos, Switzerland, where he will attend a global economic conference popular among politicians, journalists and well-heeled business leaders.

Before leaving town, he also told reporters that he favored a path to citizenship for undocumented immigrants, known as Dreamers, who were brought to the U.S. illegally when they were young.

“We’re going to morph into it—it’s going to happen,” Mr. Trump said.