A phrase meaning to be betrayed by another. The figurative use of the phrase, meaning simply to deceive or cheat, began in the early 20th century; for example, this piece from P. G. Wodehouse's Small Bachelor, 1927:
"When Sigsbee Waddington married for the second time, he to all intents and purposes sold himself down the river."
This phrase originated in the Mississippi region of the USA during slave trading days. Slaves who caused trouble were sold from the northern slave states into the much harsher conditions on plantations in the lower Mississippi.
The earliest reference I can find to the phrase in print is in The Ohio Repository, May 1837:
"One man, in Franklin County has lately realized thirty thousand dollars, in a speculation on slaves, which ho bought in Virginia, and s old down the river."
A courtroom citation comes from a 1910 edition of the Southern Reporter: “Latham was guilty and, should he be a juror, he would send him down the river.”
Why down rather than up? To go down the river, for a slave, is to watch one’s destiny take the darkest imaginable turn.
After the Civil War, these slave-trade expressions adopted other meanings—to be cheated, betrayed, ruined, or delivered into some kind of servitude.
In reference to prison, someone can be sent either “up the river” or “down the river.”
Apparently the route to prison is a two-way stream. The “up” version, the Oxford English Dictionary says, originally referred “to Sing Sing prison, situated up the Hudson River from the city of New York.” But later the phrase was used more generally to mean any prison.