An inorganic polymer is formed by dissolution of aluminosilicate solid materials in a strong alkaline activator solution, polymerization, gelation and/or crystallization. This material possesses many superior properties to normal organic polymers, such as high temperature resistant and non-flammable. This study aims to explore the possiblity of using inorganic polymers as a fire resistant building material. Inorganic polymer foams containing ~8% of Na2O (mass ratio to solid materials) and 45-50% porosity (in volume) are synthesised from fly ash and slag and with sodium silicate solution as activator. The compressive strength, volumetric stability and phase features of the porous inorganic polymers before and after exposed to 100, 400 and 800oC temperatures are determined and analysed. After exposure to high temperature, the inorganic polymer foam without slag addition maintains the compressive strength at 100oC and 400oC and increases by 40% at 800oC. In contrast, the foam that contains 20% slag, although which has a much higher initial strength than the non-slag foam, can only maintain the strength at 100oC but lose strength dramatically at 400 and 800oC. The measurement of volumetric stability and XRD analysis indicate that the larger shrinkage of slag-containing foam and the decomposition of calcium silicate phases under high temperatures is accounting for the large strength loss. The current study shows a possibility to develop a kind of new building material with the function of transforming from nonstructural to structural upon fire.