Magnetic orientation systems have widely been used by measuring the earth magnetic field and provide a pervasive source of directional information. However, to obtain the high precision, orientation systems must be compensated prior to use for the various errors of magnetometers such as the bias, misalignment and inconsistence in sensitivity, and the pitch and roll angles, especially in dynamic state. In this study, magnetic orientation system mainly consist of three single-axis magnetometers, a tri-axis accelerometer and a tri-axis gyroscope were developed. An error-separation method was introduced to calibrate magnetometers. Data from magnetometers, accelerometer and gyroscope were fused based on Kalman filtering. In addition, accelerometer and gyroscope were also calibrated before data fusion. Experimental results showed the heading error of magnetic orientation system was about 0.1° in a static state, and <3° in a dynamic state, which proved the effectivities of the calibration methods and data fusion algorithm.