I'm not a geologist, but I infer from that website I read that the mineral can be salts, or form up as crystals (as in the cave) which they did do, in the environment of heated water.
"Selenite
Buried beneath the Sierra de Naica mountain in Chihuahua, northern Mexico, the Cueva de los Cristales (Cave of Crystals) is home to the largest crystals on planet Earth.
Volcanic activity beneath the mine filled the cave with hot water.
Gargantuan, milky white beams of selenite, some as long as 11m and more than 1m wide, criss-cross the underground chamber. "There is no other place on the planet where the mineral world reveals itself in such beauty," says
Juan Manuel García-Ruiz of the University of Granada in Spain, a geologist who studies the crystals.
The crystals were discovered in 2000 by two brothers excavating new tunnels in the Naica mine, in search of fresh reserves of zinc, silver, and lead.
The cavity, which measures about 10m by 30m, had previously been flooded with heated water. Only when the miners started pumping it out were the monumental structures revealed.
In 2007, García-Ruiz and his team figured out
how the crystals were able to grow so big.
The temperature has consistently hovered around the magic 58 °C mark
Around 26 million years ago, volcanic activity beneath the mine filled the cave with hot water rich in the mineral anhydrite. Anhydrite is stable above 58 °C, but as the underlying magma cooled, it dissolved into the surrounding water.
Very slowly, over hundreds of thousands of years, its chemical components reassembled as gypsum, which can take the form of crystals. Large elongate crystals of gypsum are known as selenite.
Within the Cueva de los Cristales, the temperature has consistently hovered around the magic 58 °C mark ever since.
Another crystal cave, discovered closer to the surface in Naica, also contains selenites. They are still spectacular at about 1m in length, but not as large as those of the Cueva de los Cristales, because this cave cooled faster."
(
http://www.bbc.com/earth/story/20150623-ten-crystals-with-magic-powers)