The gut microbiota plays an important role in the development of the immune and gastrointestinal systems of infants. In the present study, we investigated whether increased salmon consumption during pregnancy, maternal weight gain during pregnancy or mode of infant feeding alter the markers of gut immune defence and inflammation. Women (n 123) who rarely ate oily fish were randomly assigned to continue consuming their habitual diet or to consume two 150 g portions of farmed salmon per week from 20 weeks of pregnancy to delivery. Faecal samples were collected from the mothers (n 75) at 38 weeks of gestation and from their infants (n 38) on days 7, 14, 28 and 84 post-partum. Fluorescence in situ hybridisation was used to determine faecal microbiota composition and ELISA to measure faecal secretory IgA (sIgA) and calprotectin concentrations. There was no effect of salmon consumption on maternal faecal microbiota or on maternal or infant faecal sIgA and calprotectin concentrations. The degree of weight gain influenced maternal faecal microbiota, and the mode of infant feeding influenced infant faecal microbiota. Faecal samples collected from infants in the salmon group tended to have lower bacterial counts of the Atopobium cluster compared with those collected from infants in the control group (P= 0·097). This difference was significant in the formula-fed infants (P< 0·05), but not in the exclusively breast-fed infants. In conclusion, the impact of oily fish consumption during pregnancy on maternal and infant gut microbiota composition is limited, but significant differences are associated with maternal weight gain during pregnancy and mode of infant feeding.