Sound travels through the air as pressure waves rhythmically moving air molecules back and forth. Fog contains water droplets that scatter more of the sound energy, thus damping the sound and reducing the distance at which you can hear it. All very simple – and confirmed by laboratory experiments.
So, case closed? Not quite – because both the basic theory and experiment don’t take account of all the conditions under which fog forms.
On warmer days where the humidity is especially high, the water molecules in the air are more agitated and can only form the tiniest droplets, which have a negligible effect on the sound waves. This damp air also has a higher density than dry air, which means that the sound waves can travel more effectively and be heard over a greater distance.