Etymology
Today it means: To masturbate. Full definition →
By analogy with jack off and "Jack and Jill".
Etymology from Wiktionary, CC BY-SA 4.0.