Underground mining creates goafs, impacting resource extraction and safety. To address the issues of low efficiency and high reliance on manual operations in traditional techniques, this paper proposes a goaf scanning and modeling system (GSMS) for underground mine based on a quadruped robot. This system performs three-dimensional modeling of goafs through two main modules: frontend mapping and backend optimization, and evaluates the modeling accuracy using a multi-dimensional precision evaluation module. To validate the effectiveness of this system, both simulation and field experiments were conducted. The experimental results indicate that the goaf models established using GSMS achieved a level of accuracy comparable to traditional methods: the volume error of the constructed goaf models compared to the reference models was less than 3%, and the average profile contour similarity exceeded 98%.