Abstract Although established as an important contributor to pig health and performance, high diversity and variability of the microbiome has challenged identification of a beneficial community composition that could inform best management practice and gut modifier development. To address this challenge, rectal swabs were collected at intervals from near birth to one-week postweaning from 4 piglets in 10 litters from 13 conventional and 9 RWA barns across Canada. The 16S rRNA gene was sequenced in 1,997 fecal samples collected at ~4 days of age (4d), 1 day before weaning (W-1), and 7 days after weaning (W+7), piglets were also weighed at the time of sampling. Raw sequences were denoised and assigned to genera using DADA2. After quality control and filtering there was an average of 32,710 reads per sample, with 649 genera identified in the samples. Principal Coordinate Analysis (PCoA) plots were created using the vegan and phyloseq packages (cao model and MDS settings). Relationships between metadata factors and the microbiome were investigated using PERMANOVA analysis in the adonis2 package. In PCoA plots samples clustered by production stage, with an expected marked change of the bacterial community following weaning. Because production stage had a large effect on the microbiome the effects of metadata factors were investigated within sampling visit. Metadata factors investigated included farrowing pen (FP) location at the 4 d-old sampling, barn and rearing system [conventional versus raised without antibiotics (RWA)] and the lifetime health (LH) status including always healthy, received a health score 1 or greater at any one visit or did not complete the study. At ~4 d of age, PERMANOVA indicated that all these factors were significantly linked to the microbiome composition (P = 0.001), FP explained the most microbiome variation (R2 = 0.338), followed by barn (R2 = 0.217). Rearing system and LH explained much less of the variation, R2 = 0.009 and R2 = 0.005, respectively. At W-1, the microbiome was not significantly correlated to LH (P = 0.053); however, the other metadata factors were significant (P = 0.001) with similar R2 values to the previous timepoint (FP; R2 = 0.317, barn R2 = 0.210, and system R2 = 0.008). At W+7 all metadata factors were once again significant (P < 0.005). The correlation to FP had reduced to R2 = 0.245, cohort increased to R2 = 0.266, system effects doubled to R2 = 0.21, and LH remained very low at R2 = 0.006. However, interactions between LH and FP (R2 = 0.059) and system and LH (R2=0.003) were also observed. These results suggest that farrowing pen has a significant and lasting effect on the microbiome. The effect of being raised RWA or conventionally was very small in preweaning piglets, but that affect increased post weaning. The immediate environment early in life appears to have a large effect on piglet microbiomes and may present an opportunity for beneficial intervention.