© 2015 Macmillan Publishers Limited. All rights reserved. Despite their inherently non-equilibrium nature, living systems can self-organize in highly ordered collective states that share striking similarities with the thermodynamic equilibrium phases of conventional condensed-matter and fluid systems. Examples range from the liquid-crystal-like arrangements of bacterial colonies, microbial suspensions and tissues to the coherent macro-scale dynamics in schools of fish and flocks of birds. Yet, the generic mathematical principles that govern the emergence of structure in such artificial and biological systems are elusive. It is not clear when, or even whether, well-established theoretical concepts describing universal thermostatistics of equilibrium systems can capture and classify ordered states of living matter. Here, we connect these two previously disparate regimes: through microfluidic experiments and mathematical modelling, we demonstrate that lattices of hydrodynamically coupled bacterial vortices can spontaneously organize into distinct patterns characterized by ferro- and antiferromagnetic order. The coupling between adjacent vortices can be controlled by tuning the inter-cavity gap widths. The emergence of opposing order regimes is tightly linked to the existence of geometry-induced edge currents, reminiscent of those in quantum systems. Our experimental observations can be rationalized in terms of a generic lattice field theory, suggesting that bacterial spin networks belong to the same universality class as a wide range of equilibrium systems.