If rain falls on your heap, it will tend to leach out the fermentation products that can be toxic when concentrated.
But when a heap gets too wet, air has a harder time getting into it. Throwing a tarp over the pile before a heavy rain might be part of keeping it aerobic.
Or just build enough coarse twiggy stuff into it that you always have air channels ... but those make it hard to turn. I like to keep any stiff stems shorter than 8-12 inches so the heap is easy to turn.