The establishment of a healthy gastrointestinal milieu may not only offer an opportunity to reduce swine production costs but could also open the way for a lifetime of human health improvement. This study investigates the effects of feeding soluble fibre from flaxseed meal-containing diet (FM) and insoluble fibre from oat hulls-containing diet (OH) on histomorphological characteristics, digesta- and mucosa-associated microbiota and their associations with metabolites in pig intestines. In comparison with the control (CON) and OH diets, the consumption of FM increased (P < 0.001) the jejunal villi height (VH) and the ratio of VH to crypt depths. The PERMANOVA analyses showed distinct (P < 0.05) microbial communities in ileal digesta and mucosa, and caecal mucosa in CON and FM-diets fed pigs compared to the OH diet-fed pigs. The predicted functional metagenomes indicated that amino acids and butanoate metabolism, lysine degradation, bile acids biosynthesis, and apoptosis were selectively enhanced at more than 2.2 log-folds in intestinal microbiota of pigs fed the FM diet. Taken together, flaxseed meal and oat hulls supplementation in growing pigs' diets altered the gastrointestinal development, as well as the composition and function of microbial communities, depending on the intestinal segment and physicochemical property of the dietary fibre source.