Understanding The Situation
Whales, dolphins, and porpoises (collectively known as cetaceans) don't normally spend any time on land. Some species of cetaceans will spend short periods of time in shallow water (for example, the beach rubbing behaviour of British Columbia's killer whales) with no ill effects. Some species of dolphins (including killer whales) will also chase their prey right up onto the beach, and then quickly maneuver themselves back into the water.
However, cetacean bodies aren't designed for spending time ashore. They can overheat easily, as they cannot properly regulate their body temperatures out of the ocean. The weight of larger animals, unsupported by water, can compress their lungs and make breathing extremely difficult.
If you see a stranded whale, dolphin or porpoise, call an animal rescue organization immediately.