The "money" in the economy is actually mostly credit, and during a recession it contracts (usually from defaults) so the amount of "money" in the system is now less
Since the value of a stock is it's future cash flows discounted to the present and it's had it's current cash flows impacted, usually that makes forecasts revise those future earnings downward lowering the valuation of the company.
Other reasons are assets are sold to make up for lost income needed to pay for expenses, and stocks being liquid often get sold first.
Another example (I am no expert) is a margin call.
If I am purchasing using $100k of margin and my collateral drops to the point that I no longer have the margin. That 100k is gone. It wasn't a real 100k in the first place, it was leveraged and backed by a volatile asset.
And people sit on their cash because they don't want to make bets on the future.
So they park it in something which is believed to be incredibly safe like money market funds or a savings/checking account because a 0% to 1% rate of return beats the risk of a 20%/50%/100% haircut by investing in anything else which gets hammered by the unwinding of the recession.
The money is created when someone borrows it. But you cannot lend more than a certain multiple of what you have as deposit. This multiple is decided by the central bank.
Since the value of a stock is it's future cash flows discounted to the present and it's had it's current cash flows impacted, usually that makes forecasts revise those future earnings downward lowering the valuation of the company.
Other reasons are assets are sold to make up for lost income needed to pay for expenses, and stocks being liquid often get sold first.