1530s, "action of battering," in law, "the unlawful beating of another," from Middle French batterie, from Old French baterie "beating, thrashing, assault" (12c.), from batre "to beat," from Latin battuere (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).