The magnetic levitation system has been considered as a promising actuator in micromachining areas of study. In order to improve the tracking performance and disturbance rejection of the magnetically levitated rotary table, an iterative learning PID control strategy with disturbance compensation is proposed. The estimated disturbance compensates for the control signals to enhance the active disturbance rejection ability. The iterative learning control is used as a feed-forward unit to further reduce the trajectory tracking error. The convergence and stability of the iterative learning PID with disturbance compensation are analysed. A series of comparative experiments are carried out on the in-house, custom-made, magnetically levitated rotary table, and the experimental results highlight the superiority of the proposed control strategy. The iterative learning PID with disturbance compensation enables the magnetically levitated rotary table to realize good tracking performance with complex external disturbance. The proposed control strategy strengthens the applicability of magnetically levitated systems in the mechanism manufacturing area.