|MadSci Network: Earth Sciences|
Deserts aren't defined on the basis of sand. As a matter of fact, some people have said that Antarctica is the largest desert on Earth and there's no sand there (only snow and ice)!
The reason for this is that deserts are defined by how dry they are. A typical definition is that deserts are simply areas which receive less than 10 inches (25 cm) of precipitation (rain or snow) per year. A more sophisticated definition of deserts takes into account not just the average amount of precipitation but also the average temperature (hot climates will evaporate more water and be drier) and the frequency of precipitation (a tiny bit of rain every couple of weeks is better than all of the rain in a large once-a-year soaking).
Anyway, deserts are simply arid (dry) areas and are more often rocky with scattered vegetation like you see in the southwestern United States than areas with large sand dunes which is what people commonly imagine when thinking about, for example, the Sahara desert. In reality, areas of drifting sand dunes only occupy about 10% of the Sahara desert.
Sand dunes aren't only found in deserts either. Beaches in places like Cape Cod, the southern shore of Long Island, the eastern shore of New Jersey, etc. all consist of fairly large areas of sand with drifting dunes. These aren't desert areas.
When sand dunes do occur in deserts, they formed because there was a source for the sand (eroding nearby sandstone, for example) which accumulated by the action of blowing winds into a local depression. Over time, large accumulations may result and their movement by blowing wind and the arid climate keeps vegetation from rooting the sand into place.
Desert areas generally form by a process called desertification. In the past, before people existed, this resulted from global climate changes primarily due to plate tectonics (the movement of the Earth's continents over geologic time). In recent times, deserts have increased in size due to the actions of people who live in and near deserts. When people overgraze animals (like cattle, sheep, and goats) and cut trees for firewood or for farming, desert areas are able to increase in size because these actions destroy the vegetation which makes it easier for the soil to blow away (especially during times of drought). This is a big problem today in Africa south of the Sahara Desert.
Try the links in the MadSci Library for more information on Earth Sciences.