Using ceftiofur during the first days of life is a common preventative strategy against several bacterial diseases in pig production. This study aimed to evaluate short- and long-term effects of early use of ceftiofur on the fecal microbiota development in suckling and growing pigs. Sixty-four piglets from eight litters were assigned to the antibiotic (AB; n = 32) or control group (control; n = 32). Twelve hours postpartum (day 0) AB piglets received an intramuscular injection of ceftiofur (5.0 mg/kg body weight) or a placebo. DNA was extracted from fecal samples collected on days 0, 12, 28, and 97 for deep-sequencing of the 16S rRNA gene. The AB administration disturbed the maturational changes in the fecal microbiome, whereby effects were sex-specific. Sex-related differences in AB metabolism in females and males may have caused these diverging AB-effects on the fecal microbiota. Especially the loss of bacterial diversity and of certain taxa in female AB pigs may have contributed to the decreased body weight of these females on day 97 of life. Taken together, this study showed that an AB injection with ceftiofur 12 h postpartum markedly affected the successional changes in the fecal microbiota composition in male and female pigs, with long-term consequences for host performance.