The pharmacokinetic variability of nifedipine widely observed in the clinic cannot be fully explained by pharmacogenomics. As a new factor affecting drug metabolism, how the gut microbiota affects the pharmacokinetics of nifedipine needs to be explored. Spontaneously hypertensive rats (SHRs) have been commonly used in hypertension-related research and served as the experimental groups; Wistar rats were used as control groups. In this study, the bioavailability of nifedipine decreased by 18.62% (p < 0.05) in the SHRs compared with the Wistar rats. Changes in microbiota were associated with the difference in pharmacokinetics. The relative abundance of Bacteroides dorei was negatively correlated with AUC0-t (r = -0.881, p = 0.004) and Cmax (r = -0.714, p = 0.047). Analysis of serum bile acid (BA) profiles indicated that glycoursodeoxycholic acid (GUDCA) and glycochenodeoxycholic acid (GCDCA) were significantly increased in the SHRs. Compared with the Wistar rats, the expressions of CYP3A1 and PXR were upregulated and the enzyme activity of CYP3A1 increased in the SHRs. Spearman's rank correlation revealed that Bacteroides stercoris was negatively correlated with GUDCA (r = -0.7126, p = 0.0264) and GCDCA (r = -0.6878, p = 0.0339). Moreover, GUDCA was negatively correlated with Cmax (r = -0.556, p = 0.025). In primary rat hepatocytes, GUDCA could induce the expressions of PXR target genes CYP3A1 and Mdr1a. Furthermore, antibiotic treatments in SHRs verified the impact of microbiota on the pharmacokinetics of nifedipine. Generally, gut microbiota affects the pharmacokinetics of nifedipine through microbial biotransformation or by regulating the enzyme activity of CYP3A1.