A potentially dangerous situation was first called a hazard by the western European Crusaders after returning from the Holy Land.
It was there that they encountered and were fleeced by unscrupulous local gamblers using loaded or doctored dice.
“Hazard” is how they pronounced “al zahr”, which is the Arabic word for dice.
In time the word “hazardous”, like dicey, became a reference to anything associated with risk.