The word sounds vaguely unpleasant, a good example of form matching meaning, since Americans have for more than for 150 years used it for a variety of things that are unpleasant to various degrees.
Dictionaries often say this was its first appearance in print:
Then he poured for us a beverage which he called “Slum gullion,” and it is hard to think he was not inspired when he named it. It really pretended to be tea, but there was too much dish-rag, and sand, and old bacon-rind in it to deceive the intelligent traveler.
Roughing It, by Mark Twain, 1872.
A slang dictionary two years later defined slumgullion as “any cheap, nasty, washy beverage”. Another, roughly contemporary, memory is this:
The meals are all alike — a potato, a slice of something like bacon, some gray stuff called bread, and a cup of muddy, semi-liquid coffee like that which the California miners call “slickers” or “slumgullion.”
Travels in Alaska, by John Muir, 1915, describing a trip he made in 1879.
Today it means a cheap stew made by throwing anything handy into a pot with water and boiling it, an improvised dish which has had many other names, such as Mulligan stew and Irish stew. Other senses in dictionaries include fish offal or the waste from processing whale carcasses (in Moby-Dick, which was published in 1851, Herman Melville called it “slobgollion”).
We now know the word is a good deal older than the Mark Twain book. Many early examples refer to yet another old sense listed in the dictionaries, for the muddy waste left after washing gold ore in a mining sluice.
Were those who were instrumental in wilfully creating this unconstitutional debt ... compelled to shovel tailings and clean reservoirs half full of slumgullion until it was paid?
Mountain Democrat, California, 3 Jan. 1857. Tailings are ore residues.
From this and other appearances, including the diaries of forty-niners, it seems certain that the word originated in this sense in the California gold fields, probably around 1850. It may well be the same word as Melville’s (the similarity in form is persuasive), suggesting that miners borrowed it from an older unrecorded word that also provided Melville with his version. Many of the early miners were sailors, after all, including the crews of whaling vessels, who jumped ship in San Francisco harbour when news of the strike arrived. The word would have been a good one for the muddy mess left by their improvised extraction techniques. They later applied slumgullion figuratively and disparagingly to foodstuffs that were muddy or semi-liquid.
American dictionaries guess that it may be a combination of slum, an old English term meaning slime (nothing to do with a squalid urban area, the word for which is an old bit of slang of unknown origin) plus gullion, English dialect for mud or a cesspool. This is still known in Scots and is probably from the Irish goilín for a pit or pool.