Inertial sensors are used in an increasing number of autonomous applications. Integrating such sensors into dynamic systems, the problem of their calibration arises naturally. Existing methods often require the sensor to be accurately placed in certain poses, which can be infeasible in practice. In this paper, we present an optimization-based estimator for in-field identification of inertial biases and scale factors. Instead of predefined poses, we use measurements of an accurate global navigation satellite system receiver in the calibration algorithm. By adopting a moving horizon scheme, the resulting estimator has the potential to run on embedded hardware allowing for online calibration without sacrificing robustness. We also present an approach for the simulation of realistic sensor data. The resulting datasets are used to analyze the performance of the optimization-based estimator. The evaluated statistics clearly show that moving horizon estimation improves the robustness and accuracy of the presented calibration approach in the presence of uncertain initial conditions and outperforms traditional recursive filters.