1878, American English and Canadian English, of unknown origin, perhaps from Mexican Spanish jacal, from Nahuatl (Aztecan) xacalli "wooden hut." Or perhaps a back-formation from dialectal English shackly "shaky, rickety" (1843), a derivative of shack, a dialectal variant of shake (v.). Another theory derives shack from ramshackle.
Slang meaning "house" attested by 1910. In early radio enthusiast slang, it was the word for a room or office set aside for wireless use, 1919, perhaps from earlier U.S. Navy use (1917). As a verb, 1891 in the U.S. West in reference to men who "hole up" for the winter; from 1927 as "to put up for the night;" phrase shack up "cohabit" first recorded 1935 (in Zora Neale Hurston).