Sulfur is a major by-product of oil refining and gas processing.
Most crude oil grades contain some sulfur, most of which must be removed during the refining process to meet strict sulfur content limits in refined products. This is typically done through hydrotreating and results in production of H2S gas, which is converted into elemental sulfur in the sulfur recovery unit. The resultant elemental sulfur is in a molten state and can either be sold as a heated liquid or (more commonly) converted to solid form as blocks or pellets.
Processing of high-sulfur natural gas is also a large source of sulfur supply.
Sulfur can also be mined from underground, naturally-occurring deposits, but this is more costly than sourcing from oil and gas and has largely been discontinued.