Automatic riveting systems play a crucial role in the field of aircraft manufacturing. In the riveting process, the machine tool bears a large axial squeezing force, and the resulting deformation will inevitably affect the riveting quality. In this paper, a dual-machine riveting system is developed first, the kinematic chain model and the lower-numbered body of the system structure are constructed sequentially. Then, considering the interaction and coupling effect of the two machines in the actual riveting process, the relative stiffnesses of the dual machine in the resisting state are identified by loading tests. Based on the stiffness data at a combination of postures within the workspace, a Kriging prediction model is established to describe the relationship between stiffness and postures. According to the prediction results, the influence of rotational and translational axes on the spatial stiffness distribution of the riveting system is revealed. Finally, the online deformation compensation is realized by modifying the displacement of the feed axis on both sides. A riveting experiment is carried out, and the results demonstrate that the riveting quality is significantly improved after compensation.