Coal spontaneous combustion disasters frequently occur during deep coal mining, resulting in significant losses. Water-based foam has been shown to effectively inhibit coal spontaneous combustion disasters. The temperature of coal seam depths is a key factor influencing the stability and water retention capacity of foam. Inorganic salts, as a foam additive, have a notable impact on the structure of the bubble film. Here, the influence of temperature and calcium chloride concentration on the gas–liquid interface of sodium dodecyl sulfate (SDS) was further investigated using molecular dynamic simulations. The results indicate that calcium chloride strengthens the interfacial adsorption barrier and decreases the diffusion coefficient of water, which improves foam stability. Meanwhile, Ca2+ is concentrated in the outer Helmholtz plane of the Stern layer, while Na+ is concentrated in the inner Helmholtz plane. The preferential coordination of Ca2+ further induces the expulsion of Na+. The hydration environment of Na+ is weakened by the electrostatic shielding effect of the Ca2+ layer. Furthermore, temperature and CaCl2 concentration exhibit a synergistic effect, influencing the adsorption structure of SDS at the interface. Temperature and CaCl2 cause the SDS head group to orient more perpendicularly to the interface. Therefore, the two-dimensional distribution of SDS in the XY plane exhibits regions of aggregation, diffusion, and vacant sites. With changes in temperature and Ca2+ concentration, the proportion and number density of vacant sites gradually stabilize. SDS forms highly ordered aggregates at the air–liquid interface, which in turn enhances the stability of the foam film.