To comprehensively consider the impacts of stratification, residual pore water pressure, soil nonlinearity, and boundary permeability on consolidation settlement of soft soil foundations for accurate prediction, a continuous drainage boundary condition is proposed in this study that reflects the residual pore pressure under multistage loading, and a nonlinear elastic constitutive model based on the double logarithmic model is adopted to account for the nonlinear consolidation behaviour of soils. A UMAT subroutine is developed based on the proposed boundary condition and nonlinear elastic constitutive model. Subsequently, the developed subroutine is compared with the built-in linear elastic soil constitutive model in ABAQUS and engineering examples. The application of continuous drainage boundaries in stratified foundations is analysed, as well as the influence of factors such as the loading rate and soil nonlinearity on consolidation settlement. The results indicate that, compared to the built-in model, the subroutine developed in this study can be employed to more accurately calculate the nonlinear consolidation of multilayered foundations under multistage loading. By adjusting the loading rate parameter αk, consolidation under different loading conditions can be predicted. Additionally, the proposed boundary condition simplifies the calculations for soft soil foundations with sand layers, providing a novel computational approach for the design of construction loading schemes and long-term settlement predictions in soft soil foundations.