If your vibration is low (fear, shame, guilt, anger, anxiety, etc.) or if you are impaired (like on some drugs) then you can open a doorway during deep meditation. Think of it this way. It's like turning on your radio but it's set to a station that plays "demon" songs. That wouldn't happen if your vibration was high and you were in full control of your faculties.
Just because your vibration is low, however, doesn't mean a demon will come. It's extremely rare. I wouldn't worry about it for the most part.
I have encountered demons on the astral plane. Not pretty. I have also accidentally brought something up with me during a meditation when I had a high fever.
See this blog entry for details:
The Ghost in the Hall