The following information can be found on the U.S. Forest Service's page about the dunes:
The sand in the Oregon Dunes is from the Coast Mountain Range, which is sedimentary rock that was uplifted 12 million years ago. As rock was moved downstream by rivers, it tumbled and abraded itself into sand.
The present shoreline stabilized 6,000 years ago. Tides, wave action and strong coastal winds moved sand up to 2.5 miles inland for thousands of years. This area of dune development rests on a gently-sloping terrace of solid marine sandstone called the Coos Bay Dune Sheet. This low rock surface stretches 56 miles from Heceta Head to Cape Arago and contrasts with steep headlands found on most of the Oregon coastline which prevent inland movement of sand.
Winds are a major influence in dune formation. Summer winds blow steadily from the north and northwest at 12-16 miles per hour. Mountain barriers near the coast deflect wind currents, sculpting the sand info many different shapes. In winter, winds are generally lighter; however, they can exceed 100 miles per hour during intense winter storms. These winds blow from the south and southwest moving large amounts of sand. Seasonal changes in wind direction reshape dune sculptures and ridges.
Water influences dune formation. Strong ocean currents flowing north in winter and south in summer hold sediment from rivers near the shore. Currents, tides and wave action dredge sand from the ocean floor and deposit it on the beaches where the wind takes over. Sand absorbs and stores a large part of the annual rainfall. Where winds have removed sand down to the water table, plants have flourished. In the wet winter, the rising water table creates marshy areas with standing water several feet deep. With the upward pressure of water, the sand grains become more saturated and may float, resulting in quicksand. Look for quicksand in low, unvegetated areas between the dunes.