The correct option is D safety
The word 'hazard' refers to a danger or risk.
Option A, chance refers to a possibility of something happening.
Option B, peril refers to a serious and immediate danger.
Option C, safety refers to the condition of being protected from a danger or injury.
Option D, problem refers to something that is difficult to achieve.
Thus, according to the meaning, the word 'safety' is the opposite of the word 'hazard'.