Andrew B. Newberg said this quote

We can't tell you the origin of the experience. But we can tell you the brain does appear to be built to have these [mystical] experiences. There are examples of people reaching similar states, spontaneously. But for the most part, it takes work. Meditation and these powerful prayer experiences require dedication and practice. But people have figured out how to do this, and the question is, 'What is the source of that experience?' The answer is, 'We don't know.' Science doesn't really have an answer for you.