My husband did this. Still does a bit, but it started with a low dose of a drug often given for anxiety and to relieve pain and help sleep. I think he was given it for pain and sleep, but I was given a low dose for anxiety once. He's been thrashing in his sleep ever since, but it happens less since he came off the drugs.
Also, shadow people, I wrote an article about them for a spiritual magazine. I may dig it out, publish and tag you!