The significant increase in cadmium (Cd) and lead (Pb) pollution in agricultural soil has greatly heightened environmental contamination issues and the risk of human diseases. However, the mechanisms underlying the transformation of Cd and Pb in soil as well as the influencing factors during their accumulation in crop grains remain unclear. Based on the analysis of the distribution trend of Cd and Pb in soil during the growth and development stages of wheat (tillering, filling, and maturity) in alkaline heavy metal-polluted farmland in northern China, this study investigated the response mechanism of soil heavy metal form transformation to soil physicochemical properties, and elucidated the main determining periods and influencing factors for Cd and Pb enrichment in wheat grains. The results showed that an increase in CEC and SOM levels, along with a decrease in pH level, contributed to enhancing the bioavailability of Cd in the soil. This effect was particularly evident during the tillering stage and grain filling stage of wheat. Nevertheless, the effects of soil physicochemical properties on bioavailable Pb was opposite to that on bioavailable Cd. The enrichment of Cd and Pb in grain was significantly influenced by soil pH (r = −0.786, p < 0.01), SOM (r = 0.807, p < 0.01), K (r = −0.730, p < 0.01), AK (r = 0.474, p = 0.019), and AP (r = −0.487, p = 0.016). The reducible form of Cd in soil during the wheat tillering stage was identified as the primary factor contributing to the accumulation of Cd and Pb in wheat grains, with a significant contribution rate of 84.5%. This study provides a greater scientific evidence for the management and risk control of heavy metal pollution in alkaline farmland.