When hoping to discover a pearl, looking inside one of the oysters you slurp may not be the best plan. Food oysters in the family Ostreidae are able to produce pearls, however these tend to be small, irregular, and worth very little. Most pearls strung on necklaces come from pearl oysters, which are in a whole different bivalve family! Pearl oysters create pearls when a hard particle is coated with calcium carbonate (nacre) after entering the oyster. The oyster creates this nacre in order to cover irritants that enter its shell. This irritant is often an invading worm or a bead placed there by a human pearl farmer.
One type of pearl oyster is the black-lipped pearl oyster, which can produce a black pearl. These oysters tend to be covered in sand and algae, which allows them to camouflage into their surroundings. This is important since over-exploitation has caused populations to drop dramatically in the past(pdf).