My text book says
The problem of respiration is a matter of difficulty in the soil which is saline, water logged and rich in putrefying organic bodies-hence poor in oxygen. This problem is solved in many plants like Rhizophora sp. by pneumatophores...
Again Wikipedia says
These specialized aerial roots enable plants to breathe air in habitats that have waterlogged soil... The surface of these roots are covered with lenticels which take up air into spongy tissue which in turn uses osmotic pathways to spread oxygen throughout the plant as needed.
Gaseous exchange generally occurs through stomata and does not involve the roots. Why then does the nature of soil affects the respiration in halophytes?
Aeration is needed to all the plant body. The same concerns the roots. Plant roots also need an access to oxygen. As long as air access to the saline soils is limited, they develop pneumatophores as an adaptive measure.