Possession is possible when the consciousness is asleep or weak, and when the person has psychological vulnerabilities (obsessions, addictions, traumas, drug or alcohol use, a flawed personality, etc). Possession can be karmic, but can also occur simply by being in poor condition and being targeted by a possessor.
Our egos are demonic so we call them demons, yet there are also failed souls who are awakened in hell, and we call them demons, too. Either one can possess a body.
All of this is possible because of our psychological condition, and there are many who take advantage of it.
"Do not worry; cultivate the habit of being happy." - Samael Aun Weor