The gemstones originated from the demon Bala.

The Gods wanted to make a fire sacrifice and asked Bala to offer himself as a sacrifice.

He agreed.

Because of this selflessness, he became a huge gem. The Gods wanted to move the jewel body to a safe place. But it disintegrated into thousands of precious stones, which the wind scattered everywhere, in the oceans, in the mountains, in the forests.