1809, back-formation from ramshackled, earlier ranshackled (1670s), alteration of ransackled, past participle of ransackle (see ransack). The word seems to have been Scottish.
Reading over this note to an American gentleman, he seemed to take alarm, lest the word ramshackle should be palmed on his country. I take it home willingly, as a Scotticism, and one well applied, as may be afterwards shown. [Robert Gourlay, "General Introduction to a Statistical Account of Upper Canada," London, 1822]
Jamieson's "Etymological Dictionary of the Scottish Language" (1825) has it as a noun meaning "thoughtless, ignorant fellow."