You can find many different examples of microorganisms in soil, and most benefit the ecosystem in some way. Some of the most beneficial soil bacteria help plants utilize nutrients that they otherwise wouldn't be able to intake with their roots.
Perhaps the most well-known and studied type of soil bacteria, nitrogen-fixing bacteria assist many different types of plants with nutrient uptake. The bacteria form a symbiotic relationship with the plant, taking up residence in the roots and converting nitrogen from the air into a useable form for the plant. In exchange, the plant provides the bacteria with carbon compounds.
Another important type of bacteria, actinomycetes, work as decomposers for compounds that other bacteria and fungi he a hard time breaking down. This bacteria in dirt gives it the characteristic 'earthy' scent when you dig in your garden. Scientists also use some members of this group of bacteria to produce antibiotics.
Finally, nitrifying bacteria and denitrifying bacteria help convert different forms of nitrogen into useable forms. For example, nitrifying bacteria convert ammonium into nitrate, and denitrifying bacteria convert nitrate into nitrous oxide.