Because the businesses whose stocks are trading on the exchanges are participants in the greater economy, the stock market and the economy are strongly linked.
A bear market is associated with a weak economy. Most businesses are unable to record huge profits because consumers are not spending nearly enough. This decline in profits directly affects the way the market values stocks.
In a bull market, the reverse occurs. People have more money to spend and are willing to spend it. This drives and strengthens the economy.