In order to meet the design requirements of spacecraft for high-performance cushioning materials, the compression and cushioning properties of melamine foam under different conditions were characterized by repeated compression cyclic loading, long-term constant pressure loading, long-term constant displacement loading and other loading methods. The effects of various pretreatment methods, such as crushing pretreatment, multiple vacuumizing pretreatment and long-term compression treatment, on the compression and cushioning properties of melamine foam were analyzed. The results show that the pressure displacement curve of foam gradually lags behind with the increase of 60% repeated positive compression times. After repeated positive pressure for 50 times, 9.8% permanent plastic deformation occurres in foam. The mechanical properties of foam are greatly affected by negative pressure crushing pretreatment. The maximum pressure of 6 mm and 8 mm foam attenuated to 64% and 66%, respectively. After long-term constant displacement compression for two months, the percentage of pressure decay of foam is 14.88%. The compression test results of melamine foam can provide reference for the selection and design of cushioning materials and structures for subsequent spacecraft.