Dogs are scared of thunder mainly due to a combination of three factors: the loud, unpredictable noise; changes in barometric pressure; and static electricity buildup in the air during storms. Dogs have much more sensitive hearing than humans, so they hear the low-frequency rumbles of thunder long before humans and may also detect the atmospheric changes associated with an approaching storm. Additionally, the static electricity in the air can cause mild shocks to dogs, especially those with longer or double coats, reinforcing their fear. This fear can also be heightened by a dog's past experiences, genetic predisposition, and anxiety tendencies.
In summary, the fearful reaction to thunder is a mix of sensory triggers (sound, pressure, static) plus instinctual survival behavior, making thunderstorms particularly stressful for many dogs.