Green’s Dictionary of Slang

on the wagon phr.

also on the cart, ...water-cart, ...water-wagon
[SE water-wagon]

1. [late 19C+] voluntarily refraining from alcohol.

2. [1970s+] in ext. use of sense 1, adopting any form of self-denial, e.g. celibate, abandoning one’s use of drugs.

In phrases

ride the (water-)wagon (v.) (also climb the water-wagon)

[1900s–20s] to abstain from alcohol.