No, because President Trump is apparently basing his statement on a meeting he had with President Obama and his aides shortly after Trump won the November 2016 election and some of the people present at or informed of the details of the meeting say that a) Obama did not say that to Trump and b) Obama was not interested in starting a war with North Korea, so it would have made no sense for Obama to say that.
Consider this summary of the evidence by the New York Times, followed by other sources:
It is impossible to prove a negative, of course, but nobody who worked
for Mr. Obama has publicly endorsed this assessment, nor have any of
the memoirs that have emerged from his administration disclosed any
serious discussion of military action against North Korea. Several
veterans of the Obama era made a point of publicly disputing Mr.
Trump’s characterization on Friday.
“We were not on the brink of war with North Korea in 2016,” Benjamin
J. Rhodes, Mr. Obama’s deputy national security adviser, wrote on
John Brennan, Mr. Obama’s C.I.A. director, told NBC News, “President
Obama was never on the verge of starting any war with North Korea,
large or small.”
USA Today has a similar take:
"It is absolutely ridiculous to suggest that the Obama administration
was considering anything like that," said Michael Fuchs, who served as
Obama's deputy assistant secretary of State for East Asian and Pacific
affairs. He said Trump was simply "lying" about that exchange.
President Trump has provided no evidence to support his claim. Obama has been silent on the issue. He and the other living American presidents have (at least generally) not responded to Trump's comments about them, as noted in this March 29, 2018 Los Angeles Times story:
Obama expected Trump to keep up his campaign rhetoric and to use Obama
as a “foil to galvanize his base,” especially in moments when Trump
felt the need to boost his political standing, said Josh Earnest,
Obama’s former press secretary and a close advisor. For Obama to
return fire would make it a bigger story.
“Obama engaging Trump has a measurable upside for Trump,” said
Earnest. “But there’s no obvious benefit for the country or, of
Trump has said Obama told him this during a November 2016 meeting at the White House. But Trump's initial recollections -- as well as coverage of that meeting at the time, including this Nov. 22, 2016 Wall Street Journal story -- characterize the Obama-Trump interaction as Obama warning Trump about the challenges of dealing with North Korea:
The Obama administration considers North Korea to be the top national
security priority for the incoming administration, a view it has
conveyed to President-elect Donald Trump’s transition team, according
to people familiar with the conversations.
Only in mid-2018 did Trump recast that conversation to say that Obama told him that Obama had been close to going to war with North Korea.
Here's a CNN story from Sept. 26, 2018 addressing and later debunking President Trump's war claims:
"President Obama thought you had to go to war. You know how close he
was to pressing the trigger," Trump said at the press conference,
adding that "not thousands ... millions of people would have been
killed" in what "could have been a world war."
"If I wasn't elected, you'd be in a war," Trump declared, seeking to
bolster his claim by implying that Obama had "essentially" told him so
Shortly after Trump repeated his claim on Feb. 15, 2019, journalist Bob Woodward tweeted out excerpts from his book Fear contradicting Trump's characterization of the Obama administration's approach to North Korea. According to Woodward's reporting, Obama wanted to avoid war with North Korea, so in September 2016 he asked the Pentagon to analyze whether it would be possible to eliminate North Korea's nuclear capabilities in a surgical military strike. After a month of study the Pentagon reported back that the U.S. could only take out about 85% of all of North Korea's known nuclear weapons and that to be certain the United States would have to conduct a ground invasion. Obama rejected the idea of attempting the surgical strike.
Woodward also discusses the hour-long Obama-Trump meeting at the White House. After the meeting Trump told his staff that Obama had warned him that dealing with North Korea would be his biggest nightmare.
Shortly after he took office, Trump asked Marine Gen. Joseph Dunford, the chairman of the Joint Chiefs of Staff, to come up with a plan to preemptively attack North Korea, according to Woodward.