Based on the lateral consolidation compression experiment of remolded soil simulating the effects of pile driving and soil squeezing, in this paper, the microstructures of soil with different degrees of lateral consolidation were investigated by a scanning electron microscope. Combined with Image-Pro Plus software to process data, parameters such as the equivalent diameter, porosity, circularity, directional frequency and fractal dimension of the soil microstructure were analyzed. The results demonstrate that the microstructure of the soil sample before consolidation was debris, aggregated particles and irregular flake aggregates. Following consolidation, the microstructure became a closed flake structure, where an obvious agglomeration phenomenon occurred. During the process of lateral consolidation compression, the large pore structure was more likely to be compressed and damaged, resulting in a decrease in the equivalent pore diameter and plane porosity, the approaching of circularity towards unity and an increase in the compaction and homogenization of soil with obvious directionality. Soil particles moved continuously under the action of consolidation compression to adjust the microstructure, and the fractal dimension gradually increased. Then, as consolidation compression continued, it gradually developed to a new equilibrium state, where the fractal dimension began to decrease and approach stability.