Pectins are dietary fibers with different structural characteristics. Specific pectin structures can influence the gastrointestinal immune barrier by directly interacting with immune cells or by impacting the intestinal microbiota. The impact of pectin strongly depends on the specific structural characteristics of pectin; for example, the degree of methyl-esterification, acetylation and rhamnogalacturonan I or rhamnogalacturonan II neutral side chains. Here, we review the interactions of specific pectin structures with the gastrointestinal immune barrier. The effects of pectin include strengthening the mucus layer, enhancing epithelial integrity, and activating or inhibiting dendritic cell and macrophage responses. The direct interaction of pectins with the gastrointestinal immune barrier may be governed through pattern recognition receptors, such as Toll-like receptors 2 and 4 or Galectin-3. In addition, specific pectins can stimulate the diversity and abundance of beneficial microbial communities. Furthermore, the gastrointestinal immune barrier may be enhanced by short-chain fatty acids. Moreover, pectins can enhance the intestinal immune barrier by favoring the adhesion of commensal bacteria and inhibiting the adhesion of pathogens to epithelial cells. Current data illustrate that pectin may be a powerful dietary fiber to manage and prevent several inflammatory conditions, but additional human studies with pectin molecules with well-defined structures are urgently needed.