Why are my gears moving but my wheels not turning?
Inside your rear wheel is what is called a free hub. It has a ratcheting mechanism that allows you to pedal backwards while conversely engaging when you pedal forward so to transfer pedal force to the wheel. I've been stuck on a trail more than once due to a free hub failing to engage. 

Unfortunately your free hub is generally not servicable. Depending on the quality of the wheel, it is sometimes cheaper to just buy a new wheel vs paying someone to re lace your existing one. 

Other than a broken chain, which would be obvious, I don't know of anything else that would cause your wheel not to move when you pedal forward. 

Cheers.