Piglets are susceptible to weaning stress, which weakens the barrier and immune function of the intestinal mucosa, causes inflammation, and ultimately affects animal growth and development. Ellagic acid (EA) is a natural polyphenol dilactone with various biological functions. However, The mechanisms underlying the effects of EA on animal health are still poorly known. Herein, we examined whether dietary supplementation with EA has a positive effect on growth performance, intestinal health, immune response, microbiota, or inflammation in weaned piglets. Sixty weaned piglets (age, 30 days) were randomly divided into two groups: the control group (basic diet) and the test group (basic diet + 500 g/t EA). The pigs were fed for 40 days under the same feeding and management conditions, and the growth performance of each individual was measured. At the end of the feeding period, samples were collected from the small intestinal mucosa for further analysis. Using these tissues, the transcriptome sequences and intestinal microbial diversity were analyzed in both groups. An inflammation model using small intestinal mucosal epithelial cells (IPEC-J2) was also constructed. Dietary EA supplementation significantly increased the average daily weight gain (ADG) and reduced diarrhea rate and serum diamine oxidase (DAO) levels of weaned piglets. Transcriptome sequencing results revealed 401 differentially expressed genes in the jejunum mucosal tissue of pigs in the control and test groups. Of these, 163 genes were up-regulated and 238 were down-regulated. The down-regulated genes were significantly enriched in 10 pathways (false discovery rate < 0.05), including seven pathways related to immune response. The results of bacterial 16s rDNA sequencing show that EA affects the composition of the intestinal microbiota in the cecum and rectum, and reveal significant differences in the abundances of Prevotella_9, Lactobacillus delbrueckii, and Lactobacillus reuteri between the test and control groups (P < 0.05). Experiments using the inflammation model showed that certain doses of EA promote the proliferation of IPEC-J2 cells, increase the relative mRNA expression levels of tight junction-related proteins (ZO-1 and Occludin), improve the compactness of the intestine, reduce the expression of inflammatory factors TNF-α and IL-6, and significantly reduce LPS-induced inflammation in IPEC-J2 cells. In conclusion, we found for the first time that dietary supplementation of EA affects the gut immune response and promotes the beneficial gut microbiota in weaned piglets, reduces the occurrence of inflammatory responses, and thereby promotes the growth and intestinal health of piglets.