First, and importantly, the IPO price is a sacred thing. The company, investors and the lead IPO underwriter all want to see the stock trade up in the after-market. When a stock trades up in the aftermarket, everyone wins. However, when a stock price falls below the IPO price, the IPO is considered "broken," the company and investors are disappointed and the lead underwriter suffers reputational damage (with the company, with institutions buying the IPO, with future IPO clients, etc.). In addition, it is common for lawsuits to occur when a stock falls below the IPO price in the first days of trading (see today's news article about the first lawsuits filed in the Facebook IPO). For these reasons (and more), it is customary for the lead underwriter to work to "stabilize" the market and keep the stock price above the IPO price. This is called IPO price stabilization and it works due to the existence of a misunderstood tool called the over-allotment option (it's also known as a Green Shoe after the first company to use this mechanism).
As part of the IPO, the company will grant the underwriters an over-allotment option to buy additional shares from the company that can be exercised for up to 30 days after the IPO. This over-allotment option is typically for a number of shares equal to 15% of the shares offered in the IPO, and has an exercise price equal to the IPO price. Then, armed with this over-allotment option, the underwriters go and sell the IPO. But what they really do is sell more shares than are indicated in the prospectus (yes this is legal), and oversell the IPO by 15% (equal to the number of shares covered by the over-allotment option). Crazy, you say? Let's look at two scenarios: (1) the stock price goes up; and (2) the stock price goes down.
If the stock price goes up, then the underwriters must deliver those oversold shares. Since the number of oversold shares equals the number of shares subject to the over-allotment option, all the underwriters do is exercise the over-allotment option and receive the shares from the option to cover the over-selling. Note that the underwriters don't make a killing by doing this. They over-sold the offering at the IPO price, and exercised the option at the IPO price, so there's no huge profits made here, (however, the underwriters do get their underwriting fees and commissions on these shares, so they do get an additional 15% commission).
If the stock price goes down, then it's a little more complicated. As mentioned above, the lead underwriter will support the stock at the IPO price, with a view to not let it "break" the IPO and fall below the IPO price. The lead underwriter accomplishes this by buying shares back from the market at the IPO price, which helps to stabilize the price and also removes shares from the market (reducing supply). Because the IPO was oversold, the lead underwriter can buy back these oversold shares at the IPO price with no impact to its balance sheet. But, once all of the oversold shares are bought back, then if the lead underwriter continues to stabilize and buy shares at the IPO price, its balance sheet is at risk. If there's a lot of downward pressure on the stock and the lead underwriter has already bought back all of the oversold shares, it will stop stabilizing and the stock price will fall and 'break" the IPO. This is what happened in the Facebook case.
Let's use an example. Let's say LattaCo goes public and sells 10 million shares in its IPO at $10 per share, raising $100 million. As part of the IPO, it grants its underwriters (Acme is the lead underwriter) a 30-day over-allotment option equal to 15% of the IPO shares (1.5 million shares) at the IPO price. LattaCo and Acme go on the IPO roadshow and Acme starts to build the IPO order book. While doing so, Acme actually sells 11.5 million shares to buyers at $10 per share.
Once the stock starts trading, the initial trade is $12 per share and the price keeps going steadily up from there, closing its first day of trading at $15 per share and closing at $20 per share a couple days later. A successful IPO. But Acme sold 11.5 million shares - how does it make good on those 1.5 million extra shares? This is where Acme exercises the over-allotment option to obtain those extra shares. It exercises the option, obtains the 1.5 million shares, delivers the shares, and everyone wins.
But what if the stock doesn't perform well. Let's assume LattaCo starts trading at $11 per share, but the price starts to drift down to the $10 IPO price. When the trades get to $10 per share, the lead underwriter Acme will begin to support the stock price by buying shares at $10 per share. Because the IPO was oversold by 1.5 million shares, Acme can buy back up to 1.5 million shares at $10 per share with no impact to its balance sheet. In this case, there's no longer any need to exercise the over-allotment option, and after 30 days it will expire.
More depth. The above is a simplified explanation of the mechanics of price stabilization and the use of the over-allotment option. We could discuss how the process is like a protected short; we could discuss how the over-allotment option can be from the company and selling shareholders; and we could also discuss the mechanics of how the underwriter actually oversells the IPO by 15% (essentially they borrow the shares from insiders). But why complicate things?