The study of bacterial ion channels has provided fundamental insights into the structural basis of neuronal signalling; however, the native role of ion channels in bacteria has remained elusive. Here we show that ion channels conduct long-range electrical signals within bacterial biofilm communities through spatially propagating waves of potassium. These waves result from a positive feedback loop, in which a metabolic trigger induces release of intracellular potassium, which in turn depolarizes neighbouring cells. Propagating through the biofilm, this wave of depolarization coordinates metabolic states among cells in the interior and periphery of the biofilm. Deletion of the potassium channel abolishes this response. As predicted by a mathematical model, we further show that spatial propagation can be hindered by specific genetic perturbations to potassium channel gating. Together, these results demonstrate a function for ion channels in bacterial biofilms, and provide a prokaryotic paradigm for active, long-range electrical signalling in cellular communities.