Following preterm birth, the immature gut function and immunology must rapidly adapt to cope with bacterial colonization and enteral milk feeding. We hypothesized that intestinal epigenetic changes are involved in the gut response to preterm birth and the first feeding. Using piglets as models for infants, preterm, and term pigs were fed total parenteral nutrition (TPN) or partial enteral feeding for 5 days, followed by exclusive enteral feeding with bovine milk until day 26 (weaning age). Intestinal structure, function, microbiome, DNA methylome, and gene expressions were compared between preterm and term pigs on days 0, 5, and 26 (n = 8 in each group). At birth, the intestine of preterm pigs showed villus atrophy and global hypermethylation, affecting genes related to the Wnt signaling pathway. Hypermethylation-associated lowered expression of lipopolysaccharide-binding protein and genes related to the Toll-like receptor 4 pathway were evident during the first 5 days of life, but most early methylation differences disappeared by day 26. Regardless, sucrase and maltase activities (adult-type brush border enzymes) remained reduced, and the gut microbiota altered (fewer Akkermansia, more Lachnoclostridia and Lactobacilli) until day 26 in preterm pigs. During the 0- to 5-day period, many new preterm–term methylation differences appeared, but mainly when no enteral feed was provided (TPN feeding). These methylation differences affected intestinal genes related to cell metabolism, including increased GCK (glucokinase) expression via promoter hypomethylation. In conclusion, the immature intestine has a remarkable capacity to adapt its gene methylation and expression after preterm birth, and only few preterm-related defects persisted until weaning. Early enteral feeding may be important to stimulate the methylation reprogramming of intestinal genes, allowing rapid intestinal adaptation to preterm birth.