WASHINGTON—In a warning to fellow Republicans, Sen. John McCain said Wednesday that failure to pass comprehensive immigration legislation could mean continued election losses for the GOP and cause Republican-friendly states like Arizona to fall to the Democrats.