It’s a fine old American slang term for a jail, still widely known today. Most people would connect it with the nineteenth-century cowboys of the Wild West. It’s very likely that they knew the word, but it didn’t start to be written down until the early twentieth century. The first known example was penned by Harry Fisher, better known as Bud, in one of his early Mutt & Jeff cartoons, of 1908: “Mutt ... may be released from the hooze gow.”
Laurel and Hardy were there early on.
The word is from Mexican Spanish juzgao, a jail, which came from juzgado for a tribunal or courtroom. It shifted to mean a jail because the two were often in the same building (and the path from the one to the other was often swift and certain). In sense and language origin it’s a relative of calaboose, which is also a prison (from calabozo, a dungeon, via the French of Louisiana).
Hoosegow is now the standard spelling, though in its early days it was written half a dozen different ways. We link it in our minds with cowboys largely because so much of their lingo was taken from Spanish and then mangled to fit English ideas of the way to say it. That included buckaroo (Spanish vaquero), bronco (from a word that meant rough or rude), lasso (lazo), lariat (la reata), chaps (chaparreras), hackamore bridles (jáquima), mustang (mesteña), cinch (cincha), as well as the direct borrowings of corral and rodeo.