Oysters make pearls so they can feel better. When a grain of sand or debris gets stuck in their bodies, they ease the pain and irritation by coating it with multiple layers of nacre, the mineral that lines the inside of their shells, and pearl begins to form. Basically, pearls are like blisters, only much prettier.
A natural pearl begins its life inside an oyster's shell when an intruder, such as a grain of sand or bit of floating food, slips in between one of the two shells of the oyster, a type of mollusk, and the protective layer that covers the mollusk's organs, called the mantle.
In order to protect itself from irritation, the oyster will quickly begin covering the uninvited visitor with layers of nacre — the mineral substance that fashions the mollusk's shells. Layer upon layer of nacre, also known as mother-of-pearl, coat the grain of sand until the iridescent gem is formed.
Cultured pearls are made in the same way. The only difference is that instead of accidental circumstances, a "pearl farmer" embeds a grain of sand into the mollusk.