Constipation is a clinical condition characterized by reduced intestinal motility, dry and hardened stool, and prolonged retention. Common constipation medicines are less stable, and prolonged use can lead to dependency and side effects. Cistanche deserticola Ma, a well-known Traditional Chinese Medicine, is frequently used to alleviate constipation. In this study, we established a loperamide-induced constipation model in mice to investigate the effects of Cistanche polysaccharides (CDPS) and to explore its underlying pharmacological mechanism. The serum levels of inflammatory factors, gastrointestinal hormones and neurotransmitters of mice were measured by enzyme-linked immunosorbent assay (ELISA). Intestinal tight junction integrity was evaluated using immunohistochemistry, and Western blot was used to detect tight junction protein levels. Gut microbial community structure and metabolite content were determined using 16S rRNA sequencing and metabolomics analysis. Oral CDPS enhanced the intestinal tight junction integrity, improved barrier function of intestinal mucosa, reduced inflammation, restored intestinal microbiota balance, and regulated metabolite levels. Notably, CDPS increased the abundance Lactobacillaceae, and Rikenellaceae, while decreasing the abundance of harmful bacteria such as Parabacteroides and Proteobacteria. In summary, CDPS may prevent and treat constipation by modulating intestinal flora composition, influencing metabolite profiles, and reinforcing mucosal barrier function.