1530s, "action of battering," from Middle French batterie, from Old French baterie (12c.) "beating, thrashing, assault," from batre "beat," from Latin battuere "beat" (see batter (v.)).
Meaning shifted in Middle French from "bombardment" ("heavy blows" upon city walls or fortresses) to "unit of artillery" (a sense recorded in English from 1550s). Extension to "electrical cell" (1748, first used by Ben Franklin) is perhaps from the artillery sense via notion of "discharges" of electricity. In Middle English, bateri meant only "forged metal ware." In obsolete baseball jargon battery was the word for "pitcher and catcher" considered as a unit (1867, originally only the pitcher).