The idea is that investors are willing to pay a premium for assets that will protect them in “bad times”.
They are looking for assets whose returns an inversely related to economic conditions.
The less correlatred at asset is with economic times the more of a premium they pay.
An interpretation of the upward sloping yield curve is that investors are willing to pay a premium for short term bonds over longer term bonds.
They are doing this because they believe short term bonds will offer more protection in bad times - this are less correlated with bad times than long term bonds.