I've heard most breweries sanitize barrels with steam but even then, some bugs will remain in the barrel.
As far as when to ferment, that's up to you. Firestone Walker has a big barrel program and they do both primary and secondary fermentation in barels for different beers. Their IPA is SS primary with barrel aging but their DBA is primary fermented in barrels and secondaried in SS. Here's a
link about Firestone's process.
Barrels at $25, that's a good friend!
EDIT: Forgot to say if you primary in a barrel to use a blow-off tube.