Autofocus has attracted wide attention for unmanned aerial vehicle (UAV) synthetic aperture radar (SAR) systems, because autofocus process is crucial and difficult when the phase error is spatially dependent on both range and azimuth directions. In this paper, a novel two-dimensional spatial-variant map-drift algorithm (2D-SVMDA) is developed to provide robust autofocusing performance for UAV SAR imagery. This proposed algorithm combines two enhanced map-drift kernels. On the one hand, based on the azimuth-dependent phase correction, a novel azimuth-variant map-drift algorithm (AVMDA) is established to model the residual phase error as a linear function in the azimuth direction. Then the model coefficients are efficiently estimated by a quadratic Newton optimization with modified maximum cross-correlation. On the other hand, by concatenating the existing range-dependent map-drift algorithm (RDMDA) and the proposed AVMDA in this paper, a phase autofocus procedure of 2D-SVMDA is finally established. The proposed 2D-SVMDA can handle spatial-variance problems induced by strong phase errors. Simulated and real measured data are employed to demonstrate that the proposed algorithm compensates both the range- and azimuth-variant phase errors effectively.