Stocks historically have produced long-term gains that are bigger than those of any other asset class. Since 1926, large stocks have returned an average of 9.8% per year. What's more, they didn't lose ground during any period of 20 years or longer during that time. Those qualities make stocks much more appealing for long-term savings than, say, Treasury bonds (which have had about 5.4% average annual gains since 1926) or stashing cash under your mattress.
Stocks' return potential gives them the best chance to beat inflation over long periods. That's why they're an essential part of a good retirement portfolio.