Construction of specially shaped pile foundations by compacting the soil around the borehole with shock waves, which can effectively increase the load-bearing capacity of the pile material. The metal wire explosion in liquid has the advantages of high energy efficiency, good repeatability and controllability. The strong shock wave generated by the explosion can compress the soil to enlarge the size of pile foundations and construct shaped pile foundations, which has industrial prospects. In order to analyze the mechanism of pile expansion by metal wire explosion in liquid, a test platform was established, and parameters such as discharge voltage, current and energy were obtained. Based on the dynamic analysis software Ls-dyna, a two-dimensional simulation model of the shock wave generated by explosion in liquid acting on the soil was established, and the material parameters and model dimensions were reasonably determined. The propagation and attenuation processes of shock waves in cement slurry and soil were numerically simulated. The cumulative effect of pile foundation expansion under the action of multiple shock waves was analyzed, and compared with the test results.