Interferometric synthetic aperture radar (InSAR) is one of the best methods for obtaining digital elevation models (DEMs). However, the problem of the uncertainty of DEM accuracy affected by the perpendicular baseline still persists, which should be as long as possible to ensure the sensitivity of the phase to the height measurement, and as small as possible to ensure a high spatial coherence. Moreover, the baseline configuration design of bistatic SAR system lacks a more detailed model for reference to generate high-precision DEM. Therefore, in this paper, the optimal baseline is modeled to maximize the accuracy of height measurement. First, we analyze the influence of system parameters on the height measurement accuracy, and a propagation model from the parameter estimation error to the elevation error is derived. Then, the phase unwrapping error (PUE) that considers the spatial baseline coherence, terrain slope and phase unwrapping effectiveness is modeled and analyzed after interferometric phase simulation and adaptive unscented Kalman filter phase unwrapping. Combining the relationship between the height error and the PUE, the optimal baseline model is obtained by statistical analysis. Finally, weighted averages are used to calculate the average slope of the complex terrain and the validity and reliability of the proposed optimal baseline model are verified by two examples of complex terrains with uniformly and nonuniformly distributed positive and negative slope angles. Moreover, the optimal baseline ranges of different terrain types are also derived for reference.