It seems that late in the 1800s, brewers discovered that oyster shells, rich in calcium carbonate, served as an effective clarifying agent for finished beer poured over heaps of the crushed, briny pub litter. Later still, some unknown brewer took things up another notch and added the shells during the boil, along with the barley and hops. With that, oyster shells had become an ingredient in brewing. The biggest leap of all was yet to come, though. Just who it was that first added the slippery oyster meat itself into the boiling beer wort, no one seems to know — but multiple sources say it first happened somewhere in New Zealand in 1929
From the second link:
It actually originated solely as an April Fools’ Day gag, when the folks at Wynkoop produced a video for our national day of practical jokes that announced a new, albeit fictitious, brew made with the main ingredient of the region’s infamous dish of gimmicky cuisine: fried bull testicles, aka Rocky Mountain oysters:
From the first link:
From the second link: