The gut–brain axis refers to the bidirectional communication between the gut and brain, and regulates intestinal homeostasis and the central nervous system via neural networks and neuroendocrine, immune, and inflammatory pathways. The development of sequencing technology has evidenced the key regulatory role of the gut microbiota in several neurological disorders, including Parkinson’s disease, Alzheimer’s disease, and multiple sclerosis. Epilepsy is a complex disease with multiple risk factors that affect more than 50 million people worldwide; nearly 30% of patients with epilepsy cannot be controlled with drugs. Interestingly, patients with inflammatory bowel disease are more susceptible to epilepsy, and a ketogenic diet is an effective treatment for patients with intractable epilepsy. Based on these clinical facts, the role of the microbiome and the gut–brain axis in epilepsy cannot be ignored. In this review, we discuss the relationship between the gut microbiota and epilepsy, summarize the possible pathogenic mechanisms of epilepsy from the perspective of the microbiota gut–brain axis, and discuss novel therapies targeting the gut microbiota. A better understanding of the role of the microbiota in the gut–brain axis, especially the intestinal one, would help investigate the mechanism, diagnosis, prognosis evaluation, and treatment of intractable epilepsy.