It depends on the bat. Some species rarely defecate except in flight. This may be unfortunate for anyone beneath, but it is good for spreading seeds by fruit-eating bats.
For the rest, some animals don't mind their own effluvia, either because they are generally in water, or actually use it to identify themselves or their territory. Hippos are examples, but bats are not. Like most animals they need to keep reasonably clean and have reflex behaviour patterns that generally permit them to defecate without fouling themselves. Generally this takes some such form as either turning over or, more frequently, just protruding the hindquarters and letting fly with enough force to miss the body.
Watch an standing man urinating, and you will get the idea.