In most coastal and estuarine areas, tides easily cause surface erosion and even slope failure, resulting in severe land losses, deterioration of coastal infrastructure, and increased floods. The bio-cementation technique has been previously demonstrated to effectively improve the erosion resistance of slopes. Seawater contains magnesium ions (Mg2+) with a higher concentration than calcium ions (Ca2+); therefore, Mg2+ and Ca2+ were used together for bio-cementation in this study at various Mg2+/Ca2+ ratios as the microbially induced magnesium and calcium precipitation (MIMCP) treatment. Slope angles, surface strengths, precipitation contents, major phases, and microscopic characteristics of precipitation were used to evaluate the treatment effects. Results showed that the MIMCP treatment markedly enhanced the erosion resistance of slopes. Decreased Mg2+/Ca2+ ratios resulted in a smaller change in angles and fewer soil losses, especially the Mg2+ concentration below 0.2 M. The decreased Mg2+/Ca2+ ratio achieved increased precipitation contents, which contributed to better erosion resistance and higher surface strengths. Additionally, the production of aragonite would benefit from elevated Mg2+ concentrations and a higher Ca2+ concentration led to more nesquehonite in magnesium precipitation crystals. The slopes with an initial angle of 53° had worse erosion resistance than the slopes with an initial angle of 35°, but the Mg2+/Ca2+ ratios of 0.2:0.8, 0.1:0.9, and 0:1.0 were effective for both slope stabilization and erosion mitigation to a great extent. The results are of great significance for the application of MIMCP to improve erosion resistance of foreshore slopes and the MIMCP technique has promising application potential in marine engineering.