Modulation error is a main error source of phase-shifting technique in the field of interferometric fiber optic sensing. To solve this problem, a multistep phase-shifting method with modulation error correction capability using rectangular-pulse binary phase modulation is proposed in this paper. In this method, a pair of three-step interference signals are obtained with the <inline-formula xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink"> <tex-math notation="LaTeX">$\pi $ </tex-math></inline-formula> /2 phase modulation to generate multistep phase-shifting interference signals. The cross-correlation operation of the two signals with the same phase shift is calculated. Then, precise control of <inline-formula xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink"> <tex-math notation="LaTeX">$\pi $ </tex-math></inline-formula> /2 modulation can be realized using simulated annealing algorithm to correct the modulation error. In addition, compared with the three-step phase-shifting algorithm, the extracted five-step phase-shifting algorithm itself has a higher ability to suppress the modulation error. Simulation and experimental results demonstrate that this method can be used to demodulate the phase result with high effectiveness and stability, improve the time domain signal and reduce the total harmonic distortion (THD), which provides a novel perspective for high-performance fiber-optic sensing and phase-shifting technique. In the actual experiment, after the calibration of modulation error, THD is effectively reduced from 7.5% to 4.5%. In addition, the method is verified by the demodulation of 200 Hz and 1000 Hz signals. The method also shows excellent repeatability and linearity in demodulation of sensing signals.