There is an interesting story in the Garuda Purana which explains how diamonds, pearls, precious stones like ruby, emerald and sapphire etc are formed. Once there lived a demon (Asura) named Balasura. He was a very generous king and was very popular with his subjects. Once he defeated Indra and other demigods (Devas) and soon he became invincible.
Unable to find a way to defeat Balasura, Devas decided to perform a yajna (sacrifice). A person who appeared at the yajna advised to take advantage of Balasura’s generosity. Balasura used to never refuse people and he used to fulfill their wishes.
Devas went in the guise of common people and asked his body to be offered as sacrifice as they were performing a sacrifice for the welfare of the people. Balasura readily agreed and offered his body.
Soon the Devas took their real form and took the body of Balasura and started traveling through the sky. But the body slipped from the hands of Devas and fell on the earth and broke into many parts and got scattered throughout the earth. Wherever a part of the body fell that place became a source of jewels and precious stones.
Vajra or diamond was formed from Balasura’s bones.
Rubies were formed when Balasura’s blood fell into river.
Topaz was formed from his skin and sapphires were formed from his eyes. Several other jewels were formed from different body parts.