Sulfur is usually associated with volcanoes. It is indeed frequently present around fumaroles which indicate recent or active volcanism but most of it is actually concentrated in salt domes which are buoyantly rising salt diapirs in the crust. These salt domes are made of marine evaporite deposits. How can sulfur be there?
These domes are mostly composed of salt and other evaporite minerals, including calcite, anhydrite, and gypsum. When the salt diapir rises it will be in contact with meteoric ground water which will preferentially dissolve and carry away salt (NaCl) as the most soluble mineral there. Hence, the concentration of less soluble evaporites rises in the upper part of the salt dome (cap rock). The upper part of the cap is usually composed of calcite, below this is gypsum and further down it changes to anhydrite (unhydrated gypsum).
Salt domes are very interesting features economically but not so much because of their salt content. Salt used to be really expensive commodity centuries ago but these times have passed. It is crude oil that is often associated with salt domes that interests us so much. Oil and other hydrocarbons are lightweight and tend to migrate upward. Oil reservoirs form only if their upward movement is somehow restricted. Common structural traps for oil are salt domes, more precisely the area directly around them. Why is this important in the context of this post? Because we need (or certain bacteria needs) hydrocarbons as an energy source. They feed on it and undertake certain chemical reactions which in simplified form look like this:
CaSO4 (anhydrite) + CH4 (methane or other hydrocarbons) + bacteria = H2S (hydrogen sulfide) + CaCO3 + H2O.
Waste product of the bacterial metabolism hydrogen sulfide will react with oxygen to form elemental sulfur:
2H2S + O2 = 2S + 2H2O
Here is a beautiful rock sample which is a result of these reactions:
Sulfur and gypsum — a sample of a salt dome cap rock from Germany. The width of the specimen is 11 cm.
So it seems that an odd combination of sulfur, gypsum, and crude oil is actually pretty common. If one finds sulfur in a cap rock of a salt dome, it may be an indication that something valuable is down there. However, sulfur itself is useful mineral resource as well and may be mined by injecting superheated water into the cap rock which mobilizes sulfur which can be then pumped out and used to make sulfuric acid.