Music halls and 'the blue bag'
A recent writer corroborates StoneyB's interpretation of "the blue bag." From Peter Ackroyd, Albion: The Origins of the English Imagination (2007):
Throughout mystery plays, and early comedies, and music-hall, and pantomime, there is the same levelling humour; low comedy, of its nature, does not change significantly over the generations. There is the same passion for sudden violence, particularly when directed at infants or figures of authority, and the same mockery of women; there is the same contempt for foreigners, and the same excremental or sexual humour noticeable in the very earliest English dramas. In the nineteenth century salacious performances were known as "bringing out the blue bag."
Likewise, from Peter Davison & Jerry Silverman, Songs of the British Music Hall (1971):
One of the traditional ways of rousing laughter in illegitimate drama is by innuendo. The technique is not by any means new nor is it confined to illegitimate drama—it is to be found in Elizabethan plays of four hundred years ago. In the music hall, precisely what is assumed is left to the imagination of each member of the audience, but the implication is invariably of a kind delightfully described by Chance Newton as "cerulean," or "a touch of the blue bag." It was a favorite comic device of Max Miller's. By means of stressed rhymes he would lead an audience to expect a blue joke, but would so time what he said that he could rely on being interrupted by the loud laughter of the audience before he reached the significant word. He would then feel free to upbraid the audience vigorously for having dirty minds and giving him a bad name—and this technique was far from peculiar to Max Miller.
Henry Chance Newton, mentioned in the preceding excerpt, uses the phrase several times in Idols of the "Halls": Being My Music Hall Memories (1928):
Many well remember that some of the smart ditties that our Marie warbled ere more or less tinged with squeezes from what the dear girl herself called "the blue bag."
There was really no need whatever (as I often told her) for an artiste so really gifted both in humour and the way of "putting it over," to descend to this ceruleanism of song. Little Marie, however, chucklingly chaffing any of us who rebuked her for what we regarded as a blot upon otherwise wonderful work, was easily persuaded to drop into this thusness by some of her song-writers and certain of her so-called friends.
There came a time at last, however, when even at the "Pav.," where such "shadiness" of song and jest seemed to be encouraged in those days, Marie was "warned" by the management, but not until that management had been "warned" by others, including your humble memoriser.
...
In the meantime I must give you some account of a startling eye-opener which our beloved Marie received in administering a decoction from the Blue Bag for a toiling moiling East End audience.
...
But their humour was really of a very quaint and infectious kind, and they were always welcome, especially when they used less of the "Blue Bag."
And earlier still, from Albert Chevalier, Before I Forget: The Autobiography of a Chevalier D'industrie (1901):
A few conscientious "turns" still endeavoured to do good work. Equally conscientious critics, who had "found" the music-hall, and now found it wanting, saw in their efforts a desire "on the part of the management" to establish a higher standard. They forgave, and perhaps forgot, the residue of coarseness and inanity, in a momentary glimpse of something better. Thy exaggerated the possibilities. They reckoned without the "Blue Bag" and the purely commercial directorate.
...
It is impossible for art, with the tiniest "a," to thrive very long in our music-halls under existing conditions. It may occasionally come as a surprise, and for that reason even please for a time ; but it cannot and will not find a home there until the "Blue Bag" yields to the "Blue Pencil." I am not narrow-minded. If certain blasé individuals with jaded palates want spice, give it to them—let them wallow in it ; but see that it is in a place set apart, not in a hall where each programme contains a dead-letter footnote, requesting the audience to report to the management anything objectionable in the entertainment. Let the prurient-minded have a hall to themselves. Call it the Obscenity, but for the sake of the majority—the lovers of clean, wholesome amusement—make it an offense, punishable at law, for anyone to encroach on the prerogative of those engaged in pandering to the tastes of the Dirty and Depraved.
'The blue bag' in the laundry
As others have noted, "blue-bag" has been used in connection with laundry bluing since at least the 1860s. From "Purple Dyeing, Ancient and Modern," translated from a German article in Aus der Natur (not later than 1864) and printed in Annual Report of the Board of Regents of the Smithsonian Institution, Showing the Operations, Expenditures, and Condition of the Institution for the Year 1863 (1872):
Ultramarine is used not only to produce a blue, but also a white. Every housewife well knows that blue of some kind must be used to counteract that yellowish tinge which linen and cotton goods acquire when washed. This use of the blue color is familiarly called using the blue-bag, but using the whitening bag would, in truth, be the more appropriate phrase. As a general thing, the blue-bag is used far too freely. The effect should not be, as it generally is, to leave a blue tinge, but only to neutralize that yellow tinge with which we unavoidably associate the idea of imperfect cleansing.
And from The Economical Housewife: A Complete Practical Guide to Domestic Management for the Use of Both Mistress and Maid (1880):
THE USE OF BLUE, AND THE ABUSE. Much blue is very objectionable. Dip the blue-bag into the [clean, cold rinsing] water until it is just perceivable that it has been in.
Make your blue-bag thus—of white flannel, with a draw string a little way from the top ; put a cake of Reckitt's blue in and it is complete. Make the bag nicely, as it will last you for many years, and can be hung up over your sink. It will be handy in case of a wasp or bee sting, also.
Many washerwomen—charring-women, notably—have an immense fondness for blue, for they can hide for the tome being, by its aid, any carelessness they have been guilty of as regards washing thoroughly. Blue covers up the yellow hue consequent upon this. Very blue clothes, too, look bad, but a slight colouring of it adds to the beauty of well-washed garments.
'The blue bag' for bug bites and stings
The blue bag was also used for treating insect bites as well as stings, as we learn from this letter to the editor of the [Perth, West Australia] Western Mail (December 17, 1915):
"Reader" Beria, writes:—I always use a nob of blue for my little girl's eyes whenever a fly bites her. I rub the bite with the damp blue bag, and the swelling goes own very quickly. I leave the blue on till all the swelling goes away. If put on as soon as the fly bites it will not swell at all. The blue appears to kill the poison that the fly or other insects leave. Bung eyes were very bad up here last year. I always use the blue, and tell anyone else that has a bung eye, it is a sure cure, and your readers need not be afraid to use it. Camphorated oil is also good but much slower in taking the swelling down. We were taught in school to use the blue bag for stings and bees, etc.
Reader M.H. in the same column likewise endorses the blue bag for this purpose:
"Seeker" wants a remedy for bung eyes. I have tried different remedies, but the best is the blue bag (washing blue) as soon as the eye is stung. Wet the blue bag and apply to where the eye is stung. I don't think it hurts the eyesight. I have three children, and if a fly stings them, they come in at once for the blue bag. It stops the swelling at once, and it seems to take all the pain away.
A very early mention of this remedy appears in Take My Advice: A Book for Every Home (1872):
Sting of Bees.—Although the poison a bee emits when it inserts its sting, is proved to be a highly concentrated acid, the application of all alkalies will not neutralize the acid. The more gentle alkalies—chalk, or the "blue bag," are much more likely to effect a cure, and cannot injure[.]
I searched a number of slang dictionaries and didn't find any slang use of "blue bag," aside from Eric Partridge's note in A Dictionary of Slang and Unconventional English, fifth edition (1961) that Sidneyites had, since circa 1910, used "the Blue Bags" as a slang term for "Newtown footballers."
Conclusion
Performers in the music-hall era seem to have viewed the "blue bag" not as a receptacle to pull naughty innuendo about naked bunnies out of, but as the familiar nineteenth- and early twentieth-century laundry aid—a cake of bluing tied in a cloth bag and immersed briefly in cold rinse water to help make white clothes look less yellow or dingy, or applied to an insect sting to make it less painful.
How this connection originated is not clear to me, but expressions such as "a touch of the blue bag" and "squeezes from the blue bag" and "administering a decoction from the blue bag" and "use the blue bag" are much easier to explain as laundry related than as grab-bag related.