Safety valves were first used on steam boilers during the industrial revolution. Early boilers without them were prone to accidental explosion when the operator allowed the pressure to become too high, either deliberately or through incompetence.
They are required on water heaters, where they prevent disaster in certain configurations in the event a thermostat should fail. There are still occasional, spectacular failures of older water heaters that lack this equipment. Houses can be levelled by the force of the blast.
The term safety valve is also used metaphorically.