Depends on where you are, the cost of renting vs. owning, and whether you plan to move. If you expect to be moving in the next 5 years or so (more likely in your 20s than your 40s) then home ownership usually doesn't make sense.
Real estate is also a lot less liquid than stocks, and that can be a concern too.