Digital Surface Model (DSM) generation from high-resolution optical satellite images is an important topic of research in the remote sensing field. In optical satellite imaging systems, the attitude information of the cameras recorded by satellite sensors is often biased, which leads to errors in the Rational Polynomial Camera (RPC) model of satellite imaging. These errors in the RPC model can mislead the DSM generation. To solve the above problems, we propose an automatic DSM generation method from satellite images based on the Double-Penalty bundle adjustment (DPBA) optimization algorithm. In the proposed method, two penalty functions representing the camera’s attitude and the spatial 3D points, respectively, are added to the reprojection error model of the traditional bundle adjustment optimization algorithm. Instead of acting on images directly, the penalty functions are used to adjust the reprojection error model and improve the RPC parameters. We evaluate the performance of the proposed method using high-resolution satellite image pairs and multi-date satellite images. Through some experiments, we compare the accuracy and completeness of the DSM generated by the proposed method, the Satellite Stereo Pipeline (S2P) method, and the traditional bundle adjustment (BA) method. Compared to the S2P method, the experiment results of the satellite image pair indicate that the proposed method can significantly improve the accuracy and the completeness of the generated DSM by about 1–5 m and 20%–60% in most cases. Compared to the traditional BA method, the proposed method improves the accuracy and completeness of the generated DSM by about 0.01–0.05 m and 1%–3% in most cases. The experiment results can be a testament to the feasibility and effectiveness of the proposed method.