First of all, they wore leather flight caps, not helmets. Despite the fact that they were basically a suicide squad, they still had to wear them to protect their ears and head from cold while at high altitudes and also to avoid going deaf when flying with their cockpits open. This was something they used to do to be able to see better when landing or taking off or looking for landmarks.
Also it helped to protect their head in case they had to do complex maneuvers to avoid getting shot out of the sky. So basically, while they were going to die, they wore helmets to make sure they didn't die before they were supposed to