He'd be in good company. Eugene Debs ran for president from a jail cell in 1920, having violated the Espionage Act by publicly opposing U.S. involvement in World War I. But Debs was in jail for speaking out against the war. McCain has another problem, and it isn't the unsubstantiated sex scandal. He may be in violation of his own law.
From WAPO:
By signing up for matching money, McCain agreed to adhere to strict state-by-state spending limits and an overall limit on spending of $54 million for the primary season, which lasts until the party's nominating convention in September. The general election has a separate public financing arrangement.
....
If the FEC refuses McCain's request to leave the system, his campaign could be bound by a potentially debilitating spending limit until he formally accepts his party's nomination. His campaign has already spent $49 million, federal reports show. Knowingly violating the spending limit is a criminal offense that could put McCain at risk of stiff fines and up to five years in prison.
There are some, including the ACLU, who believe that McCain/Feingold violates the First Amendment, so maybe he can champion the opposition to the law of his own making. Since we now know that pols borrow quotes from each other all the time, nobody should begrudge McCain credit should he repeat Debs' words upon conviction:
Your Honor, years ago I recognized my kinship with all living beings, and I made up my mind that I was not one bit better than the meanest on earth. I said then, and I say now, that while there is a lower class, I am in it, and while there is a criminal element I am of it, and while there is a soul in prison, I am not free.
Then he can break out into an old spritual - swing low sweet chariot....