Pearls are formed when a bit of sand gets into an oyster, and the oyster excretes calcite to coat the irritant until it is smooth. Understand the pearl-growing process with information from a geology professor in this free video on rocks.
Most gemstones with which we are familiar are formed by normal geological processes, and come from either igneous, sedimentary or metamorphic rock deposits. But there are a couple of precious materials, gemstones that come from biological activity. One example is amber, which comes from tree sap that hardens into a yellow interesting material that sometimes contains trapped insect fossils. But another example is the pearl, which is very familiar to a lot of people, and at times in the past has been very valuable. Although synthetic ones are made today. To understand pearls we've got to understand a little bit about the ocean, and the creatures that live there. In the ocean we have a lot of dissolved materials, the most important of which for our discussion here is the mineral calcite. Now calcite in crystalline form looks like this, but of course in the ocean the calcite is dispersed and in solution. So you only see it as a solid particle. And little creatures, and even some larger ones that live in the ocean have the ability to extract calcite, or sometimes other materials from the ocean and build a solid shell for themself. One group that does that is the mollusk, and one example of a mollusk is the oyster. A oyster is a bi-valve or pollucky pod of two shelled mollusk, this is one shell of it. And if we look at this shell it is made of calcite very similar to limestone. So if we put a little drop of acid on here, dilute acid about the strength of vinegar, we are going to get a very powerful reaction between that. Which indicates that we have a material made of calcite. So what are pearls, and how do they form? Well oysters have long been harvested for food, and people would occasionally notice that an oyster would have a little round sphere in it. And those were very, very unusual, very uncommon, and very valuable. And then over time people began to examine those and realize what was going on. If the oyster somehow when the shell is open, and it is taking water in and out. If it gets like a sand grain or some other irritant in there it will secrete calcite just like it secretes to make it's shell, but it will try to coat the irritating substance, foreign matter, what ever you want to call it, until it is smooth on the edge, and apparently doesn't bother it as much. Well once people figured that out they developed the bright idea of let's take some oysters and artificially put little irritant in them and force them to grow these pearls. And so once they did that pearl harvesting became much easier and pearls became much less expensive, although they were still valuable due to the time and effort it takes to get them. Now if you go and buy just cheap costume jewelry today they are going to be like artificial pearls, synthetically made, and not really from an oyster. But that is the story of pearls, and how dissolved minerals in the ocean end up being used by creatures in the ocean, not only to make their homes in which they normally lived, but also to protect them against little irritants within their shells and that leads to the development of pearls.