Sleepwalking is a tricky thing. It usually happens (if it happens at all) during transitions between stages of sleep, and during deeper stages too. This is why it’s hard to wake up sleepwalkers. It’s a mostly harmless activity, but there are plenty of cases where people have injured themselves during sleepwalking (look up a comedian named Mike Birbiglia for more on that).