They get an irritant inside their shell and deposit layers of calcium carbonate around the irritant to seal it off. I wonder if the same would happen if you got a pube down your foreskin but didn't wash it off.