Animal rehabilitation centres provide a unique opportunity to study the microbiome of wild animals because subjects will be handled for their treatment and can therefore be sampled longitudinally. However, rehabilitation may have unintended consequences on the animals’ microbiome because of a less varied and suboptimal diet, possible medical treatment and exposure to a different environment and human handlers. Our study describes the gut microbiome of two large seal cohorts, 50 pups (0–30 days old at arrival) and 23 weaners (more than 60 days old at arrival) of stranded harbour seals admitted for rehabilitation at the Sealcentre Pieterburen in the Netherlands, and the effect of rehabilitation on it. Faecal samples were collected from all seals at arrival, two times during rehabilitation and before release. Only seals that did not receive antimicrobial treatment were included in the study. The average time in rehabilitation was 95 days for the pups and 63 days for the weaners. We observed that during rehabilitation, there was an increase in the relative abundance of some of the Campylobacterota spp and Actinobacteriota spp. The alpha diversity of the pups’ microbiome increased significantly during their rehabilitation (p-value <0.05), while there were no significant changes in alpha diversity over time for weaners. We hypothesize that aging is the main reason for the observed changes in the pups’ microbiome. At release, the sex of a seal pup was significantly associated with the microbiome’s alpha (i.e., Shannon diversity was higher for male pups, p-value <0.001) and beta diversity (p-value 0.001). For weaners, variation in the microbiome composition (beta diversity) at release was partly explained by sex and age of the seal (p-values 0.002 and 0.003 respectively). We mainly observed variables known to change the gut microbiome composition (e.g., age and sex) and conclude that rehabilitation in itself had only minor effects on the gut microbiome of seal pups and seal weaners.