The origin is from ancient prisoner restraint methods -- approximately around the late middle ages, prisoners wore a heavy metal
by a chain on their
legs, to prevent them from making a run for their
freedom (or at least, that is the way medieval prisoners are often depicted in modern popular culture).
The allusion is that one's wife will not let one go anywhere (mostly meant as "go out", rather than
"run away from her"), much like
the ball and chain.
--Ho, Bob, ya havin' 'nother?
--Nah, gotta head home pal, 'cause otherwise
the old ball and chain will come in here an' drag