Meaning
Very rarely.
Origin
Ask the man on the Clapham omnibus the question 'What is a blue moon exactly?' and you are likely to get one of three answers:
1. Duh.
2. It's the second full moon in a calendar month.
3. It's when the moon looks blue.
Let's start with 3. Very occasionally, the moon actually does appear to be blue. This sometimes occurs after a volcanic eruption, like that of Krakatao in 1883. Dust particles in the atmosphere are normally of a size to diffract blue light, making the moon appear reddish at sunset. Larger volcanic dust particles diffract red light, making the moon appear bluish.
Tempting as it is to suppose that something that happens very rarely, and which is mentioned by name in a phrase that means 'very rarely', is the source of the phrase, it probably isn't.
Actual examples of the moon appearing blue would in fact be the exception that proves the rule, as the 'blue moon' was originally something that was considered not rare but impossible. The two notions, 'a blue moon' and 'the moon is made of green cheese', were synonyms for absurdity, like 'pigs might fly'.
The 'blue moon' expression with the 'impossibility' meaning is old and dates back to mediaeval England. For example, a work by William Barlow, the Bishop of Chichester, the Treatyse of the Buryall of the Masse, 1528, included a sarcastic reference to a blue moon:
Yf they saye the mone is belewe,
We must beleve that it is true.
In the following year, John Frith's essay A pistle to the christen reader, 1529, included:
"They wold make men beleue... that ye mone is made of grene chese."
Only after several centuries, and after the original usage had long since died out, did 'once in a blue moon' come to mean something that didn't happen very often. The earliest example of it that I can find is in Pierce Egan’s Real Life in London, 1821:
How’s Harry and Ben? - haven’t seen you this blue moon.
Moving on to answer No. 2. To explain that one we have to follow a long trail of etymological research, leading back to an American amateur astronomer called James Pruett.
Since 1819, The Maine Farmers' Almanac has listed the dates of forthcoming blue moons. The compilers of the almanac had their own definition of what blue moons are. This derives from the fact that lunar and calendar months aren't quite the same and that some years have 13 full moons. In a typical 12-moon year, the moons all have names, like the familiar 'Harvest Moon', 'Hunter's Moon' etc. In a 13-moon year the extra moon is, somewhat arbitrarily, deemed to be the third moon in the season that has four rather than the usual three, and is called the 'Blue Moon'. The aforementioned James Pruett read an edition of the Maine Farmers' Almanac, but misinterpreted the system and printed the 'second full moon in a month' version in a 1946 edition of the Sky & Telescope Magazine. For some reason, probably because it ended up being printed as an answer in an early version of Trivial Pursuit, Pruett's version has gained currency.
Two full moons in a month isn't really all that rare an occurrence - it happens approximately every three years. Despite it being both inaccurate and coined by mistake, Pruett's No. 2 answer is now widely accepted as a definition of 'blue moon'.
http://www.phrases.org.uk/meanings/once-in-a-blue-moon.html