We changed the spelling of the word “hoosegow” most decidedly, but that was done only to preserve the American idea of a phonetic pronunciation, spelled as sounded to an American ear.
That is, the Mexican term is juzgao, derived from Spanish juzgado, a tribunal.
But to the ordinary Mexican the term means a jail, and that is the meaning given also to the American term.
Literary use did not appear, or has not been traced, before 1920, but I am certain it was in colloquial Western speech a dozen or more years earlier.