For clarity, I'll use two expressions, "liquidity premium" and "illiquidity premium":
- "Liquidity premium" arises when investors value the liquidity profile of an instrument so much that they are willing to pay for the enhanced liquidity, thus pushing the price of the instrument above fair value (and its yield below fair value).
- "Illiquidity premium" arises as ex-ante compensation for expected future difficulty to unwind. Here, "difficulty" can range from higher execution cost, to being forced to sell at depressed prices, to outright inability to sell at all. If you expect these conditions might occur in the future, a rational, risk-averse investor would demand more compensation upfront, in the form of a higher yield (or a lower price).
To focus purely on (il)liquidity premium and not be bothered by credit risk, let's look at examples from the US Treasury market.
First, the chart below shows the yields of all Treasuries in February 2000, chosen for dramatic effects. The most recently issued 10- and 30-year bonds clearly stand out with notably lower yields than surrounding issues. This is partially because these bonds could be financed at lower repos (known as "financing advantage" - this is beyond the scope of this post), but also because investors valued the superior liquidity of these bonds so much that they were literally willing to pay a higher price (and receive a lower yield) for the privilege of buying and holding these bonds.
Let's move to a more stressful environment. The picture below shows the Treasury yield curve on December 15, 2008, the height of the financial crisis. As you can see, investors were once again extremely willing to pay extra for the most liquid bonds (e.g., 10s and CTD into the bond futures), which pushed down their yields significantly. By contrast, some of the older 30-year notes became extremely undesired and very difficult to trade; some investors, in desperate need for liquidity, were forced to sell them at a steep discount (assuming they could find any buyer), pushing up their yields well above fair values.
A more persistent example comes from the Treasury Inflation-Protected Securities market. For many years after the Treasury first started issuing TIPS, the yields of these securities were much higher than justified, mostly because investors demanded an illiquidity premium ("illiquidity" is a strong word in this case; TIPS were liquid, but much less liquid than comparable nominal Treasuries). As it turns out, investors' caution was warranted. During the financial crisis, the TIPS market became extremely illiquid and TIPS traded at very depressed prices, as can be seen in the sharply rising TIPS yield below:
As to whether liquidity premium pushes yield curve to be upward sloping, that's certainly not much of a factor for the Treasury market. A better theory is the existence of term premium, aka bond risk premium.