Synthetic aperture radar (SAR) is an essential tool for maritime surveillance in all weather conditions and at night. Ships are often affected by sea breezes and waves, generating a three-dimensional (3D) swinging motion. The 3D swing ship can thereby become severely defocused in SAR images, making it extremely difficult to recognize them. However, refocusing 3D swing ships in SAR imagery is challenging with traditional approaches due to different phase errors at each scattering point on the ship. In order to solve this problem, a novel method for refocusing swing ships in SAR imagery based on the spatial-variant defocusing property is proposed in this paper. Firstly, the spatial-variant defocusing property of a 3D swing ship is derived according to the SAR imaging mechanism. Secondly, considering the spatial-variant defocusing property, each azimuth line of the SAR 3D swing ship image is modeled as a multi-component linear frequency modulation (MC-LFM) signal. Thirdly, Fractional Autocorrelation (FrAc) is implemented in order to quickly calculate the optimal rotation order set for each azimuth line. Thereafter, Fractional Fourier Transform (FrFT) is performed on the azimuth lines to refocus their linear frequency modulation (LFM) components one by one. Finally, the original azimuth lines are replaced in the SAR image with their focused signals to generate the refocused SAR image. The experimental results from a large amount of simulated data and real Gaofen-3 data show that the proposed algorithm can overcome the spatial-variant defocusing of 3D swing ships. Compared with state-of-the-art algorithms, our approach reduces the image entropy by an order of magnitude, leading to a visible improvement in image quality, which makes it possible to recognize swing ships in SAR images.