First of all, "rich" is not an absolute term, but relative. Compared to people a thousand years ago, we are all fabulously rich - we possess invaluable boons such as modern medicine, electricity, cars, industrial machines, the internet, advanced education, and so on. Actually, even within our time, even the poor people in first world countries are rich compared to people in third world countries, both in terms of the "nice things" they have (like smartphones and tasty food) and in real financial terms (US federal minimum wage is several times higher than median income of many countries for instance). However, most people are not rich in the sense of having more money than others in their community. This is a consequence of statistics - wealth can be distributed in three ways:
- Evenly, which is the egalitarian utopia where everyone is equally wealthy and consequently no one is rich (though they may possibly have very comfortable lives)
- Top heavy, where most people are about equally wealthy, but rich by virtue of being more wealthy than a small minority of horrendously poor people
- Bottom heavy, where a minority is much more wealthy than everyone else
Your question sounds like the first option, or possibly like the second option. It so happens that in our world and in history, we always see the third option. The reasons for this are complex and have literally spawned whole disciplines, so I won't go into them here. But your question also asks some specific things about markets, so I think it's worth examining those in detail, so that rather than saying why everybody isn't rich, we instead look at what's to stop anybody from getting rich.
Of course the vast majority of the population is utterly ignorant about investment and good financial discipline. A lot of people don't even realize they can invest in stocks, they don't know how, they think it's a scam like a casino, they're frightened because they don't understand how it works, they don't have the patience or interest to read up on it, and so on. But knowledge and willingness are not critical factors, because even among experienced investors and traders it's rarely the case that everyone gets rich. The reason is that strategies such as buying the S&P are not such no-brainers, as you would expect TANSTAAFL, and the supposedly guaranteed returns are actually not so guaranteed and imply significant risk.
With any long term investment, you have to keep in mind that safe as the investment may be on paper and indeed in reality, life can always throw a curveball at you. Suppose I had a deal for you: You give me $100k now, in 30 years you can cash out $10 million. For the sake of the argument let's pretend this is for real, I'm backed by the FDIC or whatever, there's no way you won't get your 10 mil in 30 years. But if you cash out at year 29, you only get 100k. Now suppose you buy into this, and then a year later you get a deadly disease that costs $90k to cure. Now maybe you can get a loan, maybe you can use the investment as collateral, maybe you can work something out, but the point is that even a zero risk investment cannot be made without risk, because living by itself carries inherent risk. Things like unexpectedly losing your career, health problems, natural disasters or unexpectedly early retirement you can count under this.
The index also doesn't return so much as to make capital irrelevant. You still need a significant chunk to start, comparable to what it would cost to buy a house. Most people don't have that (millions of Americans don't even have net worth greater than zero). The average is considered to be 7% annual, so if you got a steady 7% every year for 30 years, your money still only goes up about 8-fold. If you started with 10k, you now have 76k (a big chunk of which may go to taxes). Hardly much richer than you were, and maybe you could have found a better use for those 10k in the three decades it took. In reality, the market doesn't even return a steady 7%, so you would get significantly less than 1.07^30 in the end.
In the very long term the index has returned about the same regardless of "timing", but timing does make a difference. You can set yourself back by almost a decade of gains by buying in right at the peak. In fact the peak is exactly when you will feel most confident about investing because the "the market always goes up". Furthermore, the long term upside presupposes actually holding it that long. What if an emergency happens right as you wait out a crash - you will be forced to realize the paper loss. More commonly, every time there is a crash, you will be very tempted to sell and cut your losses. It's not merely a matter of mental discipline either - the past growth in the index does not guarantee future returns and it could stop growing any time. What would it take for you to stop holding the bag and walk away?
Also, something that I think often goes unnoticed is that it is mostly the US indices that look attractive. Few other countries' look as good. Most economies are already less stable than the US's, but also when the US does crash, the other indices tend to crash with it, but rarely recover as vigorously. The point isn't to agonize over which country's index is better, but to recognize that the tremendous performance of the S&P is a reflection of the prosperity of the USA as a country. It's not going up and up "just cause", but because for the three centuries of its existence, the USA has generally been a country blessed with tremendous natural advantages, a very industrious, productive population and a government that stewarded these resources well. This could change any time, and the US (or whatever other stable country you live in) could become like those "other countries". The principal fundamental support of the supposedly guaranteed S&P growth would thus be destroyed, and your investments would be toast - forget gains, you'd be lucky to walk away with your principal. It sounds fantastic, but when your horizon is 20 or 30 years you have to consider these things. History is full of economies that were doing better and better, with everyone wondering where it'll stop, until they did stop. Then nobody wonders anymore. There's a saying on Wall Street - trees don't grow to the moon.
There are also other "safe" strategies like value investing (as famously championed by Warren Buffet) - but if you read Buffet's book for instance you see that it's not just "buy at low PE", you have to do some serious research and analysis to vet the companies you look at. Not everyone can do that. Some companies have low PE, because their business is doomed and the market knows about it. Sometimes a company is overlooked by the market, and the market keeps on overlooking it when it's time to sell your stock and cash out. And so on with every other sure bet strategy, there is never much reward without risk and hard work.
Furthermore, it's worth considering that when you buy an asset, and sell it years later for a profit, where's that money coming from? It's not like you did much work to add value. Somebody must have bought high and sold low. In some sense, the economy is probably not zero-sum and you provide liquidity and so on. You can for instance consult the GDP, which for most countries (including USA) is growing. But the growth is modest, so I'd suggest a large part of your gain is someone's loss. So going back to "why isn't everyone rich?" - because you can't get rich from stocks without someone else (many someone else's, in fact) getting poorer. The economy just doesn't grow that fast.
But all of that said, many people have no fiscal strategy whatsoever. They don't save at all, or keep it all under a mattress or checkings account. These people would certainly benefit from budgeting a savings rate, and (after doing the research and consulting with a financial advisor) investing part of their savings in stocks and/or bonds. And S&P funds are a pretty good option for the former. But it's not a question of getting rich, it's a question of not getting poorer.