Teichoic acids (TAs) are anionic polymers that constitute a major component of the cell wall in most Gram-positive bacteria. Despite decades of study, their function has remained unclear. TAs are covalently linked either to the cell wall peptidoglycan (wall TA (WTA)) or to the membrane (lipo-TA (LTA)). We have characterized the key enzyme of LTA synthesis in Bacillus subtilis, LTA synthase (LtaS). We show that LTA is needed for divalent cation homoeostasis and that its absence has severe effects on cell morphogenesis and cell division. Inactivation of both LTA and WTA is lethal and comparison of the individual mutants suggests that they have differentiated roles in elongation (WTA) and division (LTA). B. subtilis has four ltaS paralogues and we show how their roles are partially differentiated. Two paralogues have a redundant role in LTA synthesis during sporulation and their absence gives a novel absolute block in sporulation. The crystal structure of the extracytoplasmic part of LtaS, solved at 2.4-A resolution, reveals a phosphorylated threonine residue, which provides clues about the catalytic mechanism and identifies the active site of the enzyme.