The origin is not clear. There are a number of theories, but none of the probable theories have anything to do with plague.
Most likely answer: the song may have been used to circumvent a religious dancing ban.
What few people realise is that the usual explanation of this rhyme being about the Black Death may be widely known, but it is also totally unsubstantiated piffle.
http://www.snopes.com/language/literary/rosie.htm
Although folklorists have been collecting and setting down in print bits of oral tradition such as nursery rhymes and fairy tales for hundreds of years, the earliest print appearance of "Ring Around the Rosie" did not occur until the publication of Kate Greenaway's Mother Goose or The Old Nursery Rhymes in 1881. For the "plague" explanation of "Ring Around the Rosie" to be true, we have to believe that children were reciting this nursery rhyme continuously for over five centuries, yet not one person in that five hundred year span found it popular enough to merit writing it down.
Children were apparently reciting this plague-inspired nursery rhyme for over six hundred years before someone finally figured out what they were talking about, as the first known mention of a plague interpretation of "Ring Around the Rosie" didn't show up until James Leasor published The Plague and the Fire in 1961.
So, what does "Ring Around the Rosie" mean, then? Folklorist Philip Hiscock suggests:
The more likely explanation is to be found in the religious ban on dancing among many Protestants in the nineteenth century, in Britain as well as here in North America. Adolescents found a way around the dancing ban with what was called in the United States the "play-party." Play-parties consisted of ring games which differed from square dances only in their name and their lack of musical accompaniment.