Difficult to answer without more information. How much sulfite did you use? What kind of water did you use, hard water, well water etc.? Is the foam on the liquid or on the wood; in other words, confirm foam and not mold. When you found the foam, did the barrel still smell like sulfite.
Dissolved air contained in tap water can form bubbles and carry residual wine components leached or exchanged from the wood staves and collect as foam at the top. The chemistry of the water you used, hardness etc., can sometimes exaggerate the issue. Microbes can cause foam, but this shouldn't be the case if you used adequate sulfite. When using this wet storage method, I would occasionally roll the barrel so the bung is at the 2 o'clock position to keep all surfaces saturated. If the barrel still smells good you're probably ok.