Previous studies have shown that gut microbiota dysbiosis could affect clinical prognosis through an unknown mechanism. However, the causal relationship between the gut microbiota and the functional outcome after ischemic stroke remains unclear. We aimed to investigate the causal association between the gut microbiota and the functional outcome after ischemic stroke using Mendelian randomization (MR). Genetic instrumental variables associated with 211 bacterial traits were obtained from the MiBioGen consortium (N = 18,340). Data from genome-wide association studies (GWAS) for functional outcome after ischemic stroke were obtained from two phenotypes (i.e., overall stroke outcome and motor recovery). The inverse variance weighted method was used to estimate the causal association. Enrichment analysis was conducted based on the results of the MR analyses. The genetically predicted family Peptostreptococcaceae (OR = 0.63, 95% CI = 0.41-0.98, p = 0.038) and the genera LachnospiraceaeNK4A136 group (OR = 0.65, 95% CI = 0.43-1.00, p = 0.048), LachnospiraceaeUCG004 (OR = 0.54, 95% CI = 0.33-0.90, p = 0.017), and Odoribacter (OR = 0.40, 95% CI = 0.21-0.77, p = 0.006) presented a suggestive association with favorable functional outcome, while the genera Eubacterium oxidoreducens group (OR = 1.77, 95% CI = 1.11-2.84, p = 0.018) and RuminococcaceaeUCG005 (OR = 1.85, 95% CI = 1.15-2.96, p = 0.010) were associated with unfavorable functional outcome. The genetically predicted family Oxalobacteraceae (OR = 2.12, 95% CI = 1.10-4.11, p = 0.025) and the genus RuminococcaceaeUCG014 (OR = 4.17, 95% CI = 1.29-13.52, p = 0.017) showed a suggestive association with motor recovery, while the order Enterobacteriales (OR = 0.14, 95% CI = 0.02-0.87, p = 0.035) and the family Enterobacteriaceae (OR = 0.14, 95% CI = 0.02-0.87, p = 0.035) were associated with motor weakness. Enrichment analysis revealed that regulation of the synapse structure or activity may be involved in the effect of the gut microbiota on the functional outcome after ischemic stroke. This study provides genetic support that the gut microbiota, especially those associated with short-chain fatty acids, could affect stroke prognosis by mediating synapse function. Our findings suggest that modifying the composition of the gut microbiota could improve the prognosis of ischemic stroke.