While, thankfully, the chances of anybody being swallowed by a large marine creature are extremely low - there's probably more chance of you being hit by a bus or an asteroid - there is hope for those that do come face to face with this situation.
News reports usually arise when survivors live to tell the tale, so the absence of recent reports of people being swallowed by whales doesn't mean that it doesn't happen...
Biblical reference in Christian belief cites that Jonah survived in the belly of a great fish without ill effect, but consistent attacks have been made on the veracity of this story. Strong opinions have been put to paper that something like this could not possibly occur and that the story is pure fabrication.
Rudyard Kipling, in his short tale How The Whale Got His Throat, tells of a shipwrecked mariner who is swallowed by a whale. He causes such a fuss in the belly of the beast that it agrees to release him, and to prevent further instances of swallowing unwary seamen, the mariner pulls a wooden grating into its gullet so that in future it will only be able to eat fish and small marine creatures.
While it is possible that Jonah's experiences have more to do with analogies than reality, and Kipling's story is just a fanciful tale, there are much more recent accounts of individuals becoming trapped inside marine creatures' bellies, only to emerge some while later still alive, if not necessarily in perfect condition.
Records of whale attacks on whaling ships have been around since the 19th Century. While similar attacks may occur in modern whaling, the structural integrity of ships and enhanced sensor equipment mean that catastrophic attacks are less likely to occur.
In the winter of 1820, a Sperm Whale attacked the American whaling boat Essex in the South Pacific, holing and capsizing her 1. While many of the crew were able to get to safety, a number were never accounted for.
In March 1863 near Cape Cod, a whaling boat was struck by a whale sending a crewman overboard into the creature's open mouth. The sailor's legs got caught in between its teeth, and after the whale died from injuries sustained from exploding harpoons, he was rescued and revived.
Bartley and the Star of the East
In the late winter of 1891, the whale-ship Star of the East was in the vicinity of the Falkland Islands when it came within sight of a whale. Two boats were dispatched with harpoons to snare and kill the beast, but the lashing of its tail capsized one of the launches, spilling the crew into the sea. All were accounted for except for a single sailor, James Bartley.
Ultimately the whale was killed and the carcass drawn aboard the vessel to begin the process of salvaging valuable resources. By the next day good progress had been made in removing the layers of blubber from the beast, so a tackle was attached to its stomach to hoist it on deck. Sailors were startled by spasmodic life within the belly of the whale, and upon further inspection the missing sailor was found.
Bartley was quite mad for two weeks, but upon recovering his senses he recounted what little he could recall of being dragged under the water. Struggling for his life he had been drawn into darkness within which he felt a terrible and oppressive heat. He found slimy walls that gave slightly to his touch, but could find no exit. When his situation finally dawned on him Bartley lost his senses completely and lapsed into a state of catatonia.
During his time inside the whale the gastric juices affected his exposed skin. His face, neck and hands were bleached a deathly white with a texture like parchment, a condition from which the skin never recovered. Bartley believed that he would probably have lived inside his house of flesh until he starved, as breathing was not a problem.
There are, however, reports that suggest that this whole story is nothing more than an early Urban Legend.
Baleen whales prefer plankton, krill and the like, so large, flailing humans are only likely to be consumed accidentally. However, there are 65 species of toothed whale, including the Sperm Whale, and they are known to eat very large creatures whole.
While not actually a whale, the killer whale, or Orca, has been known to attack and consume creatures as big as the great white shark, a dozen feet in length. In 1997 video footage was recorded of such an attack off the Farallon Islands2.
The sperm whale has a voracious appetite and 11-inch teeth. They consider sharks and giant squid fair game in making up the ton of food they can consume in a day. In comparison, your average human swimmer is merely a snack.
Advice for Swallowees
Once inside, sit tight and try not to touch anything if at all possible. Gastric processes are invasive and skin does not recover well from encounters with digestive fluids. The process by which gastric acid handles food is slow and wearing clothing, especially of the synthetic variety, is likely to buy you some time.
Escape from the belly of a whale, aside from simple survival, may be far more difficult as the majority of whales - especially the Baleen whales that rely on sieving minuscule marine life forms for their diet - have complex digestive systems. They may have up to four stomach chambers, rather like the multi-stomach system of a cow, which allows a controlled channelling of foodstuffs through the digestive system. There is also the constant intake of seawater that results from their feeding processes. Unless someone is looking for you, or you have a very large cutting implement and a strong stomach, you may have to be satisfied with simply surviving until starvation takes you or good fortune saves the day.
If all else fails you might consider using pepper or a small fire to smoke your way out.
1 Events expanded upon in the book In the Heart of the Sea : The Tragedy of the Whaleship Essex by Nathaniel Philbrick.
2 The Farallon Islands are situated 28 miles due west of the Golden Gate Bridge, San Francisco, USA.