However, foggy conditions also promote accidents because they affect perceptual judgments of speed and distance. The effects are the result of reduced contrast. We see objects, not based on their absolute brightness or darkness, but on their difference between the object brightness and background. Fog lowers contrast substantially, causing objects to become fainter and less distinct. The physical cause is that same as the scattering effect in rain.
Light hits the droplets of fog or rain and scatters.
Scattering becomes more pronounced as the size of the droplets decreases, so a fine rain causes more scatter than a rain with large drops. Fog is produced by suspension of very fine droplets in the air, so the amount of scattering is even larger and there is more loss of contrast and more backscatter from headlights. This is the reason that you should not use high beams in fog. It may seem natural to switch to high beams so that you can see further. In fact, the main effect is to scatter more light back to the eye and actually decrease visibility.