If sharks have cartilage instead of bones how can they fossilize?

Yes, shark skeletal systems are composed of cartilage, the clear gristly stuff that your ears and nose tip are made of. And, you are correct that in its pure form, it doesn't fossilize. However...as most sharks age, they deposit calcium salts in their skeletal cartilage to strengthen it. The dried jaws of a shark appear and feel heavy and solid; much like bone. These same minerals allow most shark skeletal systems to fossilize quite nicely. The teeth have enamel so they show up in the fossil record too.