Temporal lobe epilepsy is hypothesized[1][2] to be a contributing factor towards the visions, fits, etc that various prophets throughout history experienced. Something like half of those with temporal lobe epilepsy experience hyperreligiosity or salvation[3] with their condition, along with religious hallucinations, delusions, etc.
[1] https://en.wikipedia.org/wiki/Temporal_lobe_epilepsy#Effects...
[2] https://en.wikipedia.org/wiki/Geschwind_syndrome#Hyperreligi...
[3] https://pubmed.ncbi.nlm.nih.gov/2654983/