The small intestine is not only critical for nutrient absorption, but also serves as an important immune organ. Medium-chain fatty acids have nutritional and metabolic effects and support the integrity of the intestinal epithelium. However, their roles in intestinal immunity in pigs are not fully understood. We investigated the effects of a medium-chain fatty acid, capric acid, on intestinal oxidative stress, inflammation, and barrier function in porcine epithelial cells and miniature pigs after treatment with the immune suppressant cyclophosphamide. Capric acid alleviated inflammatory cytokine production (TNF-α and IL-6) and related gene expression (NF-κB, TNF-α, IFN-γ), alleviated oxidative stress (GSSG/GSH ratio, H2O2, and malondialdehyde), and increased oxidative stress-related gene expression (SOD1 and GCLC) in cyclophosphamide-treated IPEC-J2 cells. The permeability of FD-4 and expression of ZO-1 and OCLN in cyclophosphamide-treated IPEC-J2 cells were reduced by capric acid. Dietary capric acid reduced TNF-α, IL-6, and MDA levels and increased SOD, GPx, and the expression of genes related to pro-inflammatory, oxidative stress, and intestinal barrier functions in cyclophosphamide-treated miniature pigs. These results revealed that capric acid has protective effects against cyclophosphamide-induced small intestinal dysfunction in pigs.