If you want to buy or sell a stock or other security on the open market, you normally trade via agents on the market scene who specialize in that particular security. These people stand ready to sell you a security for some asking price (the "ask") if you would like to buy it. Or, if you own the security already and would like to sell it, they will buy the security from you for some offer price (the "bid"). The difference between the bid and ask is called the spread. Stocks that are heavily traded tend to have very narrow spreads (e.g., 1/8 of a point), but stocks that are lightly traded can have spreads that are significant, even as high as several dollars.
So why is there a spread? The short answer is "profit." The long answer goes to the heart of modern markets, namely the question of liquidity.
Liquidity basically means that someone is ready to buy or sell significant quantities of a security at any time. In the stock market, market makers or specialists (depending on the exchange) buy stocks from the public at the bid and sell stocks to the public at the ask (called "making a market in the stock"). At most times (unless the market is crashing, etc.) these people stand ready to make a market in most stocks and often in substantial quantities, thereby maintaining market liquidity.
Dealers make their living by taking a large part of the spread on each transaction - they normally are not long term investors. In fact, they work a lot like the local supermarket, raising and lowering prices on their inventory as the market moves, and making a few cents here and there. And while lettuce eventually spoils, holding a stock that is tailing off with no buyers is analogous.
Because dealers in a security get to keep much of the spread, they work fairly hard to keep the spread above zero. This is really quite fair: they provide a valuable service (making a market in the stock and keeping the markets liquid), so it's only reasonable for them to get paid for their services. Of course you may not always agree that the price charged (the spread) is appropriate!
Occasionally you may read that there is no bid-ask spread on the NYSE. This is nonsense. Stocks traded on the New York exchange have bid and ask prices just like any other market. However, the NYSE bars the publishing of bid and ask prices by any delayed quote service. Any decent real-time quote service will show the bid and ask prices for an issue traded on the NYSE.
Related topics that are covered in FAQ articles include price improvement (narrowing the spread as much as possible), stock crossing by discount brokers (narrowing the spread to zero by having buyer meet seller directly), and trading on the NASDAQ (in the past, that exchange's structure encouraged spreads that were significantly higher than on other exchanges).