Soybean-induced anaphylaxis poses a severe threat to the health of humans and animals. Some commensal bacteria, such as Lactobacillus and Bifidobacteria, can prevent and treat allergic diseases. Prebiotic oligosaccharides, a food/diet additive, can enhance health and performance via modulating gut microbes and immune responses. The purpose of this study was to examine whether fructo-oligosaccharides (FOS) could alleviate soybean-induced anaphylaxis by modulating gut microbes. Piglets (21 days of age) were sensitized with a diet containing 5% soybean and 30% peeled soybean meal. The treatment with 0.6% FOS started 1 day prior to sensitization and continued everyday thereafter. Blood was collected for measurements of immune indices. The DNA samples isolated from fresh intestinal contents of the middle jejunum (M-jejunum), posterior jejunum (P-jejunum), ileum, and cecum were used for gene sequencing based on 16S rRNA. Our results showed that there was an increase of glycinin-specific IgG, β-conglycinin-specific IgG, total serum IgG and IgE, and occurrence of diarrhea in piglets sensitized with soybean antigen. There was a decrease in interleukin 4 (IL-4) and IL-10 and an increase of interferon-γ (IFN-γ) in piglets with FOS treatment, compared with the piglets without FOS treatment. Improvement of intestinal microbes was indicated mostly by the increase of Lactobacillus and Bifidobacteria in M-jejunum and the decrease of Proteobacteria in P-jejunum and ileum. The correlation analysis indicated that FOS treatment decreased those closely related to the key species of gut microbes. These results suggest that FOS can alleviate soybean antigen-induced anaphylaxis, which is associated with increased Lactobacillus and Bifidobacteria in M-jejunum and declined Proteobacteria in P-jejunum and ileum of piglets.