Nitrogen-fixing bacteria play a crucial role in soil by converting atmospheric nitrogen into a form that plants can absorb and use for their growth. This process, known as nitrogen fixation, helps in increasing soil fertility and overall plant health.