We use combine high resolution neutron diffraction (HRPD) with density functional theory (DFT) to investigate the exchange striction at the Curie temperature (TC) of Fe2P and to examine the effect of boron and carbon doping on the P site. We find a significant contraction of the basal plane on heating through TC with a simultaneous increase of the c-axis that results in a small overall volume change of ~0.01%. At the magnetic transition the FeI-FeI distance drops significantly and becomes shorter than FeI-FeII . The shortest metal-metalloid (FeI-PI) distance also decreases sharply. Our DFT model reveals the importance of the latter as this structural change causes a redistribution of the FeI moment along the c-axis (Fe-P chain). We are able to understand the site preference of the dopants, the effect of which can be linked to the increased moment on the FeI-site, brought about by strong magneto-elasticity and changes in the electronic band structure.