The word commute in the sense of "travelling to and from work" actually has the same origin as the other senses of the word. Commute broadly means "to change to something less severe", so a death sentence is commuted to life imprisonment.
The usage of commute to mean travel goes back to the 1840s:
The term “commute” derives from its original meaning of “to change to
another less severe.” In the eighteen-forties, the men who rode the
railways each day from newly established suburbs to work in the cities
did so at a reduced rate. The railroad, in other words, commuted their
fares, in exchange for reliable ridership (as it still does, if you
consider the monthly pass). In time, the commuted became commuters. In
New York, and in cities like Philadelphia, Boston, and Chicago,
railways begat reachable and desirable suburbs, so that, by the time
the automobile came along, patterns of development, and a calculus of
class and status, had already been established. -- There and Back Again, New Yorker, April 16, 2007
Sense of "go back and forth to work" is 1889, from commutation ticket
"season pass" (on a railroad, streetcar line, etc.), from commute in
its sense of "to change one kind of payment into another"
A traveller would buy a commutation ticket - one which was commuted from a higher to a lower price. As they commuted their tickets, so they became commuters. Once cars were invented, the term commuter came to mean anyone who travels regularly.