In January 2016, Warmbier was arrested for stealing a banner from his Pyongyang hotel. Shortly after, he went on trial. According to the North Koreans, he then contracted botulism and fell into a coma. And though the North Korean government claims he has been in a coma for over a year, the State Department only learned of his condition a week ago -- at which point it began to advocate for his release.
The State Department is still investigating the North Korean version of events.
From the North Korean perspective, it may be rational for Pyongyang to take American prisoners and rational to release them under the right circumstances. And while engaging in such behavior is outrageous by any standard of decency, North Korea has little other direct leverage over the United States. Sure, it can fire on American, South Korean or Japanese forces, but if it does, it risks a major military conflict that it cannot win.
If it seizes an American who has traveled to North Korea by choice, it can attempt to extract concessions without provoking an American military strike. North Korea therefore has every incentive to release a prisoner when an arrangement is made, or risk its credibility in future negotiations.
So while the State Department was critical in securing Warmbier's release, Kim likely had additional motivations.
First, if Warmbier had died, he would have carried less weight in any sort of negotiation with the US government. Alive, he could potentially record messages pleading for his release and serve as a human shield in the event of an attack. But if he died, in addition to reducing North Korean negotiating power, he could provoke retaliation. If North Korea does not have the ability to cure Warmbier, or if his condition is not curable, it is far better to return him than to let him die in a North Korean prison.
Second, his release can be spun by Pyongyang as a "humanitarian" gesture. He may, according to Kim, deserve to spend 15 years doing hard labor, but North Korea can claim it is making a gesture of good will, be it ever so small. North Korea may sink ships, fire missiles and hold thousands of people in "re-education camps," where they are subject to forced labor and hours of ideological indoctrination, but it eventually let this sick kid go home to his parents, so it's not entirely bad, right? North Korea does not have a sophisticated public diplomacy operation inside Western countries, but it also has no natural audience that it could expect to sway to its "side." All it can hope to do is to ratchet down, or at least not ratchet up, an American drumbeat for war.
Finally, President Trump has shown that, for better or worse, he purports to care about American lives more than the lives of anyone else. He is even willing to send refugees and asylum seekers back to their potential deaths in order to protect Americans from alleged security risks.
As Trump said
of Syrian refugees during the campaign, "I'm putting the people on notice that are coming here from Syria as part of this mass migration, that if I win, if I win, they're going back." And in the era of Trump, the consequences of an American death in Pyongyang could be far greater than that of thousands of Koreans or Japanese.