What Mercutio is saying is that he wants bad things to happen to both the Capulet family and the Montague family. Literally, he is wishing that they will both be hit by terrible illnesses -- that's what a plague is.
As to why he says it, it is because he is pretty annoyed because he is dying. He is dying because of this stupid feud between the two families. He blames them both equally for his fate and so he curses both families. He keeps repeating it because he is, of course, in physical and mental pain as he dies.
This happens to be one of the most significant quotes throughout the whole play!! I LOVE it!! Okay, so basically, when Mercutio says this, he's cursing the Capulet family AND the Montague family. He said this right after he was stabbed by Tybalt; Mercutio knew that he was going to die, and he was VERY angry. The main thing from this quote involves fate (believe it or not). If Romeo would have never went to the Capulet party, he would've never met Juliet, and the two of them would've never fallen in love. If this wouldn't have happened, then the fight between Mercutio and Tybalt could have been prevented. If this were the case, then Mercutio would have never been killed. All in all, Mercutio is saying that both sides are at fault. He's not blaming it just on Tybalt or the Capulet family, but instead blaming it on Romeo, Juliet, the feud between the families, etc.