While there’s no way to predict the future, historically, the market has always risen. And historically, how long or short you have to wait until seeing a gain on your investments, is heavily influenced by your own investing habits! We cannot predict the performance of your investments.
The great depression was the longest and largest stock market decline in history, and looking at the worst extreme is a helpful way to orient investors with their current approaches.
Hypothetical Investor A: made a one-time investment in the S&P 500 in September 1929 at the market high, and sold at the market low in June 1932, locking in an 86% loss.
Hypothetical Investor B: made a one-time investment in the S&P 500 also at the market high in 1929, and didn’t see a gain until September 1954.
Hypothetical Investor C: made weekly investments into the S&P 500, each in the same size and with the first investment also taking place at the 1929 market high. They saw a gain by September 1935.
Investor A never sees a gain as they effectively locked in their losses. Investor B sees a gain after 25 years, having only made one investment and never another. Investor C, after 6 years of passively investing in the market, sees a gain for themselves nearly 20 years before the market ends up reaching a new high again. When you see a gain ultimately depends on how the market performs + what actions you take or don’t take as an investor.
To be sure, the Great Depression was very extreme, as every other downturn following took an average of 3 years to reach a low point and then make its way back to a new all-time high again! But even in the extreme case, we can see the benefits of staying actively invested for the long term. The S&P 500 has returned 9.8 percent a year, on average, over the last 90 years (including those Great Depression years!).
Remember, you can't invest directly in an index and past performance is not a guarantee of future results.
For more on what you can expect from investing in the stock market, see this Learn article: How Does the Stock Market Work?