Let us touch on xenogeneics for a moment. My octopus pearl is a perfect example.
We all know octopuses do not have shells. We do know they are green blooded creatures (copper based as opposed to iron in mammals), as are all other mollusks.
My specimen had a visible scar from a predator attack. One and a half legs were amputated. Octopus recover upwards of 25% of what they eat in body weight, hence grow fast and eat lots.
The consensus is this. The octopus escaped the attack alive and went on with his routine gathering food. Because the proximity of the pearl from the beak was a mere inch, it stands to reason a small piece of mantle tissue from the octopus's meal ( a clam, mussel, oyster or cockle perhaps) drifted off to become lodged in the wound. The octopus's own blood stream supplied the "graft" and the epithelial cells continued to grow, forming the pearl.
It's really quite simple.