The general health and safety rule is that hard hats are required in any workplace where accidents are likely to happen at any time and in workplaces where objects can fall from one level to another. Building sites are a prime example in which tools, nails, clamps and other pieces of building material can and do get knocked or dropped. The most obvious trade or occupation in which hard hats must always be worn is the construction industry.
Any occupation where an employee is likely to bump their head against any sort of fixed object requires all workers to wear a hard hat. There could be beams or pipes or other hard objects in the workplace. A hard hat will give protection against such accidents.
Then too there are exposed electrical conductors which are a danger to workers. Hard hats are essential in workplaces were these objects are present.
Of course a hard hat must be maintained in good condition and always worn the correct way. No hard hat can be guaranteed to prevent an injury in every situation but a hard hat can and does significantly reduce the damage which can be caused by an accident in the workplace.