Hallucinations are characteristic of some forms of mental illness and can be frightening, causing distress to those who endure them. They can also occur after taking hallucinogenic drugs, with the possibility of both pleasant and unpleasant "trips".
Visions are part of the lore of religions like Judaism and Christianity. These visions may result from mental illness or from drug use, but they also occur when these conditions do not apply. There may be an expectancy of seeing an angel, or the Virgin Mary, and an excited mental state may be common in these cases, but no drugs are involved and nor is mental illness. What then is the basis of these visions?
Let's begin to answer that question by looking at two visions described in the Holy Bible:
Daniel's vision 
Having seen a number of animals (this must have been in a dream as he was lying face down?), Daniel then recounts:
..there stood before me as the appearance of a man.. ..he came near where I stood: and when he came, I was afraid, and fell upon my face.. ..as he was speaking with me, I was in a deep sleep on my face towards the ground: but he touched me, and set me upright
Cornelius' vision 
Cornelius was a devout Christian centurion who:
..saw in a vision evidently about the ninth hour of the day an angel of God coming in to him..
I assume that the ninth hour was in daylight and that his vision was not a dream, but we have no information on his state of wakefulness.
Both these visions, and those of others, could be explained by Charles Bonnet Syndrome. Charles Bonnet was born in Geneva in 1720 and qualified as a lawyer, although he probably never practised the law . He was always fascinated by Natural History and wrote papers in the field of Entomology while still training to be a lawyer, later making many contributions to Botany when his eyesight began to fail during his twenties. Bonnet could then no longer work on small-scale observation and it was not only his sight that failed - he already had hearing loss from the age of seven . As someone who suffered from sensory deprivation, he became interested in this subject and the way that it influenced the incidence of visions. He studied the phenomenon in his elderly grandfather and it is from these descriptions that he is best known in the medical world.
We can describe Charles Bonnet Syndrome (CBS) as :
..the occurrence of recurrent or persistent complex visual hallucinations often of a pleasant nature, which may be considered pseudohallucinations, in individuals with preserved insight and intellectual function without altered consciousness, cognitive or psychiatric disturbances, sleep disorders, or focal neurological lesions and often associated with ophthalmic pathology. CBS occurs predominantly in elderly, visually impaired people.
Further in their review, Menon and colleagues  state:
The typical CBS hallucination has been variously described as a sudden sharply focussed, immobile image, most often the face or figure of a person, which occurs when the patient is alert, with eyes open and vanishes spontaneously after a period of seconds.
However, there are other causes than failing eyesight for the occurrence of hallucinations :
Charles Bonnet-type hallucinations have also been documented in the absence of ocular or neurological disease, in type II diabetes mellitus with normal vision, in leprosy, in association with HIV infection.. ..and in the elderly, where they can occur in the absence of apparent cause.. ..it is interesting that fatigue and disturbances of vigilance have been implicated as relevant to the emergence of hallucinations, as they are more likely to occur during states of drowsiness.
Knowing this about the incidence of CBS, does it provide an explanation for the visions of Daniel and Cornelius described above? Could the phenomenon explain other visions that are so vivid to "observers" that do not have mental illness or use drugs? The visions are certainly real to those that have them and this is not surprising if they result from the neural pathways used to interpret visual images from the eyes via the optic nerves. It is rather like a mental short-cut that accesses the processing power of the brain, without the need for a direct stimulus.
 http://www.kingjamesbibleonline.org/ section of Daniel Chapter 8
 http://www.kingjamesbibleonline.org/ Acts Chapter 10 verse 3
 Thomas R. Hedges Jr. (2007) Charles Bonnet, his life, and his Syndrome. Survey of Ophthalmology 52: 111-114.
 G. Jayakrishna Menon, Imran Rahman, Sharmila J. Menon and Gordon N. Dutton (2003) Complex visual hallucinations in the visually impaired: the Charles Bonnet Syndrome. Survey of Ophthalmology 48: 58-72.