Gayhole is an archaic spelling of the word gaol, which in turn was borrowed from Norman French gaiole. Via a process of folk etymology, the Norman French gaiole was spelled as gayhole.
Incidentally, the alternative spelling jail has the same etymological root, from Latin caveola, meaning "little cage," but was borrowed from Parisian French jialole.
The modern English word goal (as in football/soccer) also comes from this same root (a "little cage").
In helle is a deop gayhole. --Eleven Pains of Hell, ca. 1300
Þe Duyk let nime þat maide...and in-to þe gayhole lede. --The South English Legendary, ca. 1300
To my Gayhol goþ anon. --Sir Firumbras, ca. 1380