The physical and mechanical properties of rocks at high temperatures change considerably with geothermal exploitation, underground coal gasification, and nuclear engineering construction, posing a threat to the safety of underground engineering. To investigate the effect of temperature on micro‐ and macroscale damage of sandstone, a series of uniaxial compressive strength (UCS) tests were conducted using an MTS 815 mechanical testing system. Acoustic emission (AE) monitoring, scanning electron microscopy (SEM), and nuclear magnetic resonance (NMR) were also employed. Macroscopically, it was found that the physical and mechanical properties of sandstone change with treatment temperature, but these changes do not follow a monotonic trend. In addition, the brittle‐ductile transition occurs at approximately 600°C, which is further confirmed by AE monitoring. Regarding the microstructural evolution of sandstone, the percentage of micropores shows a monotonically decreasing trend with increasing treatment temperature. The change in mesopores decreases slightly first, then shows a gradual increase, and finally decreases. The macropores first decrease and subsequently increase with increasing temperature. The decreasing trend of the meso‐ and macropores is attributed to thermal expansion at a relatively low temperature. However, the decrease in mesopores is due to their coalescence into macropores at higher temperatures. Furthermore, the integral value of the NMR spectrum first decreases and then increases with increasing treatment temperature, corresponding to the decrease in porosity from 25°C to 200°C, and then increases with temperature to 900°C. Finally, a constitutive model for the deformation and fracture of sandstone is established based on the effective medium theory and AE energy. The present study is helpful for improving the understanding of the process of thermal damage sandstone from both micro‐ and macroscale perspectives.