In a speech on global security in London, Johnson urged the government of Kim Jong Un to "change course" and engage in diplomacy to resolve the crisis.
"By continuing to develop nuclear capabilities, Kim risks provoking a reaction in the region that is at once defensive and competitive, that reduces not increases his security and therefore reduces not increases the survival chances of the regime," Johnson said.
Johnson called for North Korea's neighbor China to lead efforts to pile economic pressure on Pyongyang, but also said US Secretary of State Rex Tillerson had rightly offered North Korea "sensible reassurances" that it does not seek regime change or invasion.
But he said Trump has an "absolute duty to prepare any action" to keep America and its allies safe.
More From This Section
"I don't think anybody can conceivably want a military solution to this problem," Johnson said. "And yet clearly it must remain on the table."
He said that if North Korea changed tack, "the world can show that it is once again capable of the diplomatic imagination that produced the Nuclear Non-Proliferation Treaty" and the Iran nuclear deal.
In an implicit rebuke to Trump, he said the 2015 accord curbing Iran's nuclear program had avoided the "nightmare" of a nuclear arms race in the Middle East.
Trump has been fiercely critical of the deal and earlier this month refused to re-certify it under US law, directing Congress to make it more stringent.
Johnson said it was crucial the Iran deal survived. He said that "having spoken to some of the most influential figures on Capitol Hill -- none of them fans of the Iranian regime -- I have absolutely no doubt that with determination and courage the (deal) can be preserved."
Urging more work to curb nuclear proliferation, he said the alternative was a world of high-stakes standoffs and brinksmanship, what he called "a nuclear version of the final scene of 'Reservoir Dogs.