The expression for barely making it on time comes from the racetracks. Since only the top three (in those days, sometimes four) horses earned a payout, the third (or fourth) finisher was said to make it just under the wire - or finish line - before the next competitor.
Meaning: Do what everybody else is doing, whatever is popular.
Example: When the Chicago Bears are winning, I will jump on the bandwagon and be a fan.
Origin: Old time political campaigns would attempt to gain supporters with what amounted to a small parade including a band for a candidate with sufficient support. Jumping on the bandwagon was akin to providing your support for this popular candidate.