One reason is to indicate territory. It's been noted that dogs scratch the ground more often when they're introduced to new locations, and as they become familiar with the area (or perhaps claim it), they lesson the amount of ground scratching.
Sometimes dogs will smell a spot where another dog has peed, then scratch up a storm without ever urinating themselves. Dogs have scent glands on the bottoms of their paw pads, so scratching the dirt and disturbing the air sends information that may be different than from that of their urine.
Read my post that presents detailed facts about olfaction.