In recent decades, the quality of agricultural soils has been seriously affected by the excessive application of pesticides, with herbicides being one of the most abundant. Continuous use of herbicides alters the soil microbial community and beneficial interactions between plants and bacteria such as legume-rhizobia spp. symbiosis, causing a decrease in the biological nitrogen fixation, which is essential for soil fertility. Therefore, the aim of this work was to study the effect of two commonly used herbicides (pendimethalin and clethodim) on the legume-rhizobia spp. symbiosis to improve the effectiveness of this process. Phaseolus vulgaris plants grown in pots with a mixture of soil:perlite (3:1 v/v), showed a 44% inhibition of nitrogen fixation rate with pendimethalin. However, clethodim, specifically used against monocots, did not induce significant differences. Additionally, we analyzed the effect of herbicides on root exudate composition, detecting alterations that might be interfering with the symbiosis establishment. In order to assess the effect of the herbicides at the early nodulation steps, nodulation kinetics in Medicago sativa plants inoculated with Sinorhizobium meliloti were performed. Clethodim caused a 30% reduction in nodulation while pendimethalin totally inhibited nodulation, producing a reduction in bacterial growth and motility as well. In conclusion, pendimethalin and clethodim application reduced the capacity of Phaseolus vulgaris and Medicago sativa to fix nitrogen by inhibiting root growth and modifying root exudate composition as well as bacterial fitness. Thus, a reduction in the use of these herbicides in these crops should be addressed to favor a state of natural fertilization of the soil through greater efficiency of leguminous crops.