The method of multi-sensor integrated navigation improves navigation accuracy by fusing various sensor data. However, when a sensor is disturbed or malfunctions, incorrect measurement information will seriously affect the estimation of the trajectory, which will lead to a decrease in accuracy. Existing factor graph models based on weights can neither fully resist the influence of disturbances nor guarantee the local rationality of estimated trajectories. In this paper, a factor graph with local constraints model that fuses the magnetic field and pedestrian dead reckoning data is proposed to navigate complex curved trajectories. First, adding local constraints to the pedestrian dead reckoning measurement converts the navigation solution problem into a hard-constrained nonlinear least squares problem. Then, a mapping model is constructed to reconstruct the variable space and the Adam gradient algorithm is used to realize a fast calculation. The navigation accuracy of this algorithm is better than that of the state-of-the-art method in real-world experiments, with an average accuracy of 0.83 m.