In recent years, high-performance lightweight and multifunctional aluminum foam sandwiches (AFSs) can be successfully applied to spacecraft, automobiles, and high-speed trains. Friction stir welding (FSW) has been proposed as a new method for the preparation of AFS precursors in order to improve the cost-effectiveness and productivity of the preparation of AFS. In this study, the AFS precursors were prepared using the FSW process. The distribution of foaming agents in the AFS precursors and the structure and morphology of AFS were observed using optical microscopy (OM), scanning electron microscopy (SEM), and X-ray energy dispersive spectroscopy (EDS). The effects of the temperature and material flow on the distribution of the foaming agent during the FSW process were analyzed through experimental study and numerical simulation using ANSYS Fluent 19.0 software. The results show that the uniform distribution of the foaming agent in the matrix and excellent densification of AFS precursor can be prepared when the rotation speed is 1500 r/min, the travel speed is 25 mm/min, the tool plunge depth is 0.2 mm, and the tool moves along the retreating side (RS). In addition, the experimental and numerical simulations show that increasing the welding temperature improves the uniformity of foaming agent distribution and the area of AFS precursor prepared by single welding, shortening the thread length inhibits the foaming agent from reaching the upper sandwich plate and moving along the RS leads to a more uniform distribution of the foaming agent. Finally, the AFS with porosity of 74.55%, roundness of 0.97, and average pore diameter of 1.192 mm is prepared.