REM is the period of sleep that is associated with dreaming. REM sleep paralysis is a condition that occurs when sleep is suddenly interrupted and the person was having a dream. The paralysis sets in because the transition from being totally sleep to being fully awake is a gradual process. When it becomes sudden the body and the brain's reaction times are not the same and this causes the paralysis.
Why does it occur when you are having dreams? This is simply because dreams are not real and you should not be reacting to them. When the brain is immediately awaken in the middle of a dream you are actually trying to physically respond to something that is not there and the body goes into a state of paralysis. Can you imagine what would happen if we reacted to everything that happened while we are asleep?
So you can clearly see that anything that will interrupt the normal sleep pattern of an individual will likely cause it. There are some stimuli that the brain responds to when you are sleep. The brain does respond to light and sound. So usually sleeping in a dark and quiet room should less the occurrence of REM sleep paralysis.
There are also some things that are known to precipitate this condition. I'm referring to things like alcohol, smoking and caffeine when taken at night or before sleeping. Try and avoid tension and putting yourself under a lot of stress.
REM sleep paralysis is an acknowledged medical condition and you should not feel ashamed or embarrassed to get help for it. There are many other remedies to this problem; you are welcome to further research as information is freely available on the net.