In order to prevent coal spontaneous combustion, a highly stable inorganic solidified foam (XISF) suitable for the coal mine top-coal caving region, airtight partition wall, and ″two ends″ of working face was put forward. An ultrastable prefabricated foam (PF) was synthesized by modifying the gas−liquid interface with xanthan gum (XG). The influence of XG content on foam stability was studied by different techniques. In addition, XISF was synthesized by the prefabricated foam method using cement, fly ash, and other noncombustible inorganic materials as the matrix. The stability of PF indicated that the hydrogen bond structure induced by XG could effectively inhibit the Ostwald ripening, coalescence processes, and gravity-driven drainage of the foam. The stability of XISF indicated that when the content of XG was 0−0.3 wt %, the stability of the synthesized XISF increases with the increase of the content of XG. However, when the content of XG was 0.5 wt % (PF system), various active functional groups such as hydroxyl and carboxyl groups in XG chelated with Ca 2+ on the surface of cement particles, forming a ″shell−core″ structure that inhibits hydration. This structure destroys the stability provided by XG. The plugging air leakage test, accumulation diffusion test, and fire extinguishing test show that the improvement of stability was beneficial to improve the fire-preventing and extinguishing characteristic of XISF.