Why do dogs have whiskers?

Like other animals, dogs use their whiskers for sensory purposes. For this reason alone their whiskers are indispensable.

Unlike humans, dogs do not have shoulders (at least not the same, or as prominent as ours). Their body is approximately the same width from front to back, except for a slight dip before their rear legs. So for a dog, there's no real way to tell if they're going to fit through something or not. We humans can make this judgement by use of our shoulders. If our shoulders go through a gap, then the rest of our body will. Dogs make the same judgement by using their whiskers. A dog’s whiskers when sticking out straight are slightly wider than any other part of their body. Therefore if their whisker fit through a gap without touching, then the rest of their body will too.
It is also believed that a dog’s whiskers can pick up certain wave frequencies’. Some believe that this is how a dog can tell that there is for example a storm coming, a long time before we can.

Dog’s certainly do have exceptional senses, way better than humans. Whiskers biologically may actually work like antennas. If whiskers are sensitive then they must be connected to the nervous system in some way, which in turn is connected to the brain.