The usual explanation is that this term originated in horse racing. If a horse started ahead of the others and stayed that way for the whole race, this was called gate to wire or sometimes wire to wire - because the horses start by coming out of a gate before the race starts, and the finishing line can be called a wire. Since then the term has been applied to other sports too.