You can carry a battery in a pannier as long as they are compatible size, as battery sizes and panniers can vary a lot. The think to look out for is that batteries are quite heavy and if you are on trails and they bounce around a bit it can really put a strain on the bag, so make sure it is a well constructed one.