I'm definitely not condoning cannibalism (who thought I'd ever have to specify that?), but in human history there have been many times where that was the only means of survival. The 1993 movie Alive, tells the story of a Ugandan rugby team who crashed in the Andes mountains in 1972. The original short flight didn't have much food on board so they resorted to Cannibalism after those stocks were depleted. Murder wasn't involved (like the shipwreck mentioned below) as the crash killed many colleagues first. The survivors lived by eating the flesh that had been preserved by the cold.
The source post takes a partially satirical view of it by starting with Zombies, but actually has some factual testimonials by an Evolutionary Biologist at the University of Pittsburgh on what to eat and why.
From the Adventure Journal post:
This isn’t pretty. But it is fact. The annals of exploration are full of gruesome tales of cannibalism.
In naval circles it was well known that if a ship ran aground on a deserted island, the custom of drawing lots and killing and eating each other one by one was the norm. A 1536 English expedition landed on the Labrador coast with their main ship badly foundering. Unable to hunt, gather enough nutrition, or navigate home, they killed and ate each other. A few centuries later, and probably most famously, the ship The Essex was sunk by a giant whale that rammed it. The survivors resorted to eating each other. The whale-ramming part of this story you know, from Moby-Dick, though Melville’s 1851 novel focuses on the man vs. whale yarn and entirely skips the ignoble man-eating-man bits.
You get the point. We need to eat to survive. And time and again, we’ve eaten each other to do so.
Source -> http://www.adventure-journal.com/2012/01/dirtbag-gourmet-a-guide-to-cannibalism/