This verse is riddled with text-critical complications. In the Biblia Hebraica Stuttgartensia (the leading scholarly edition of the Hebrew Bible), it has five footnotes in the critical apparatus, indicating differences between different manuscripts. For instance, the first part, "the oracle of him who hears the words of God" (ESV), does not exist in the Septuagint or the Samaritan Pentateuch. This makes it unlikely that we can reconstruct an original version of the Hebrew.
The translation "falling into a trance" is based on the Septuagint (the Greek translation of the Hebrew) which adds ἐν ὕπνῳ "in sleep". Indeed, the Hebrew should literally be translated as "falling, and eyes being uncovered". It is possible that the Greek reflects an older version of the Hebrew (and is therefore more original), however, it seems more likely that the phrase is added to explain the Hebrew. It is unlikely that the Hebrew got corrupted and removed such a gloss as it would be important for the meaning of the text; so it is more likely it is an addition of the Septuagint.
You may be interested in 'Neurology in the Bible and the Talmud', a chapter by Moshe Feinsod in History of Neurology (Handbook of Clinical Neurology 95, 2009, pp. 37–47), which briefly discusses the episode on p. 41. It does not go in-depth with regards to the original text but can provide some background. I agree with the author that a conclusion of epilepsy is overly hasty.
Several scholars have claimed that there are a few epileptic episodes depicted in the Bible. Oddly, all happen to involve prophets. There are several instances where a person fell on his face during an epiphany, prophecy, or while getting a message from God (cf. Abraham, Moses, Bileam). It has been argued by some that they were epileptics or, at least, had an epileptic episode.
Nevertheless, Kottek (1988, 'From the history of medicine: epilepsy in ancient Jewish sources', Isr. J. Psychiatry Relat. Sci. 25: 3–11) rightfully points out that one cannot assume that the phrase falling on the face signifies epilepsy. This expression could reflect an unsuccessful attempt to translate a Hebrew idiom — one signifying humility before a superior while bowing. Indeed, it also appears in the Bible in several non-religious instances. (...)
Additionally, we read that the prophet Bileam was "falling into a trance, but having his eyes open" (Numbers 24:4, 15). The words "into a trance" actually do not appear in the Bible; the phrase is an addition by the translators. Thus, it is also difficult to accept Bileam as an epileptic prophet. Other assumptions, such as falling under the influence of drugs, can be accepted with just as much certainty (Kottek, 1988).