Middle English baylle, "wall enclosing an outer court" of a castle, fortified city, etc. (c. 1200 in Anglo-Latin, late 13c. in place-names), a variant of bail, from Old French bail "stake, palisade, brace," which is of unknown origin, perhaps ultimately connected to Latin bacula "sticks," on notion of "stakes, palisade fence."
The word was extended to mean the outer court itself (early 14c.). Hence Old Bailey, seat of Central Criminal Court in London, so called because it stood within the ancient bailey of the city wall.