Abstract Biofilms are multicellular microbial communities that encase themselves in an extracellular matrix (ECM) of secreted biopolymers and attach to surfaces and interfaces. Bacterial biofilms are detrimental in hospital and industrial settings, but they can be beneficial in agricultural contexts. An essential property of biofilms that grants them with increased survival relative to planktonic cells is phenotypic heterogeneity; the division of the biofilm population into functionally distinct subgroups of cells. Phenotypic heterogeneity in biofilms can be traced to the cellular level, however, the molecular structures and elemental distribution across whole biofilms as well as possible linkages between them remain unexplored. Mapping X-ray diffraction (XRD) across intact biofilms in time and space, we revealed the dominant structural features in Bacillus subtilis biofilms, stemming from matrix components, spores and water. By simultaneously following the X-ray fluorescence (XRF) signal of biofilms and isolated matrix components, we discovered that the ECM preferentially binds calcium ions over other metal ions, specifically, zinc, manganese and iron. These ions, remaining free to flow below macroscopic wrinkles that act as water channels, eventually accumulate and lead to sporulation. The possible link between ECM properties, regulation of metal ion distribution and sporulation across whole intact biofilms unravels the importance of molecular-level heterogeneity in shaping biofilm physiology and development. Significance Statement Biofilms are multicellular soft microbial communities that are able to colonize synthetic surfaces as well as living organisms. To survive sudden environmental changes and efficiently share their common resources, cells in a biofilm divide into subgroups with distinct functions, leading to phenotypic heterogeneity. Here, by studying intact biofilms by synchrotron X-ray diffraction and fluorescence, we revealed correlations between biofilm macroscopic architectural heterogeneity and the spatio-temporal distribution of extracellular matrix, spores, water and metal ions. Our findings demonstrate that biofilm heterogeneity is not only affected by local genetic expression and cellular differentiation, but also by passive effects resulting from the physicochemical properties of the molecules secreted by the cells, leading to differential distribution of nutrients that propagates through macroscopic length scales.