Answer :

There could be a lot of reasons. To help break down food for the plants, kill off bad and harmful things that might damage the plant. 
Bacteria are important in the soil to maintain the nitrogen cycle. Certain type of bacterais help in nitrogen fixation. They also decompose dead and decaying matter into nitrogen compounds such as ammonia. The nitrogen and nitrogenous compounds in turm help the plant to grow.

When the plant dies, the bacteria again decomposes it into nitrogenous compounds. Not only plants, but also animals. The nitrogen then passes through various stages and then gets back to atmospheric nitrogen. Bacteria is an important part of this nitrogen cycle.