To reduce the influence of gain-phase errors and improve the performance of direction-of-arrival (DOA) estimation, a robust sparse Bayesian two-dimensional (2D) DOA estimation method with gain-phase errors is proposed for L-shaped sensor arrays. The proposed method introduces an auxiliary angle to transform the 2D DOA estimation problem into two 1D angle estimation problems. A sparse representation model with gain-phase errors is constructed using the diagonal element vector of the cross-correlation covariance matrix of two submatrices of the L-shaped sensor array. The expectation maximization algorithm derives unknown parameter expression, which is used for iterative operations to obtain off-grid and signal precision. Using these parameters, a new spatial spectral function is constructed to estimate the auxiliary angle. The obtained auxiliary angle is substituted into a sparse representation model with gain and phase errors, and then the sparse Bayesian learning method is used to estimate the elevation angle of the incident signal. Finally, according to the relationship of the three angles, the azimuth angle can be estimated. The simulation results show that the proposed method can effectively realize the automatic matching of the azimuth and elevation angles of the incident signal, and improves the accuracy of DOA estimation and angular resolution.