Found this explanation for why sleepwalking occurs in this month's Scientific American Mind.
Neurologist Antonio Oliviero of the National Hospital for Paraplegics in Toledo, Spain, explains:
Sleep disorders such as sleepwalking arise when normal physiological systems are active at inappropriate times. We do not yet understand why the brain issues commands to the muscles during certain phases of sleep, but we do know that these commands are usually suppressed by other neurological mechanisms. At times this suppression can be incomplete—because of genetic or environmental factors or physical immaturity—and actions that normally occur during wakefulness emerge in sleep.
People can perform a variety of activities while asleep, from simply sitting up in bed to more complex behavior such as housecleaning or driving a car. Individuals in this trancelike state are difficult to rouse, and if awoken they are often confused and unaware of the events that have taken place. Sleepwalking most often occurs during childhood, perhaps because children spend more time in the “deep sleep” phase of slumber. Physical activity only happens during the non–rapid eye movement (NREM) cycle of deep sleep, which precedes the dreaming state of REM sleep.
Recently my team proposed a possible physiological mechanism underlying sleepwalking. During normal sleep the chemical messenger gamma-aminobutyric acid (GABA) acts as an inhibitor that stifles the activity of the brain’s motor system. In children the neurons that release this neurotransmitter are still developing and have not yet fully established a network of connections to keep motor activity under control. As a result, many kids have insufficient amounts of GABA, leaving their motor neurons capable of commanding the body to move even during sleep. In some, this inhibitory system may remain underdeveloped—or be rendered less effective by environmental factors—and sleepwalking can persist into adulthood.
Sleepwalking runs in families, indicating that there is a genetic component. The identical twin of a person who sleepwalks often, for example, typically shares this nocturnal habit. Studies have also shown that frequent sleepwalking is associated with sleep deprivation, fever, stress and intake of drugs, especially sedatives, hypnotics, antipsychotics, stimulants and antihistamines.