Nitrogen-fixing bacteria play a crucial role in soil fertility by converting atmospheric nitrogen into a form that plants can utilize. These bacteria form a symbiotic relationship with certain plants, such as legumes, where they live in nodules on the plant roots and convert nitrogen gas into ammonia through a process called nitrogen fixation. This ammonia can then be taken up by plants to support their growth and development, ultimately enhancing soil fertility and promoting healthy plant growth.