With the increasing demands for artificial intelligence, robotics, electronic skin, healthcare, and energy storage/conversion, the research focus on flexible electronics has started to shift from being merely bendable and rollable to being stretchable. In recent years, stretchable aerogels and foams have drawn significant attention in the field of flexible electronics due to their unique porous structures, low density, high porosity, and high flexibility. This work provides a comprehensive review of the state-of-the-art developments in stretchable aerogels and foams, encompassing their preparation, structures, properties, and applications. The preparation methods, typical structures of stretchable aerogels and foams, stretching principle, and the relationship between their structures, stretchability, and other properties are investigated. Their latest applications in stretchable strain/pressure sensors, electrodes and conductors, chemical sensors and biosensors, supercapacitors, batteries, triboelectric nanogenerators, electromagnetic shielding, microwave absorption, thermal management, adsorption, separation/filtration, and shape memory are introduced. Furthermore, the challenges and opportunities of stretchable aerogels and foams are summarized. This work provides a guideline for the development of stretchable aerogels and foams and next-generation high-performance flexible electronics based on stretchable porous materials.