I believe this is more common with heavy sleepers. I'm usually a light sleeper, so this is something that could never happen to me. I'm sensitive and tend to wake up as soon I start moving. Sometimes I get "startled" out of a dream, for example.
With sleep walkers, they could be having an intense dream, but instead of being startled - they may actually start moving around while dreaming! This is of course what happens during sessions of sleepwalking. It might seem dangerous, but it's not as bad as it sounds. These people may appear awake, and usually can see and react to the environment around them.
While their senses may function normally, they're not thinking the same way. Their memory and critical thinking are obviously not reliable in such a trance-like state. Dreams can induce auditory and visual hallucinations which combine with the real environment around them, and that's what poses the most danger. Usually sleepwalkers return to bed safely, and only rarely (in cases of disturbing dreams) would someone turn violent and hurt themselves or others. It's a lot like being high for several hours under a powerful drug. You're not likely to remember anything, but
usually nothing bad happens, except maybe a lot of drooling and walking around like a dumb drunkard.
If you think you're sleepwalking, try leaving a camcorder on in your room at night, aimed towards your bed. If you're a sleepwalker, you'll probably be able to catch it on tape eventually.
After confirming that you sleepwalk on occasion, ask a doctor or therapist about medication or other treatment if it bothers you. I don't really know much about it, but you might be able to improve the quality of your sleep. Good luck.