Lions can actually live in many different types of habitat and in many ecosystems. In every place they live, lions are among the predators at the top of the food chain, and have an important role in the ecosystem, keeping the populations of other animals under control.
However the favoured ecosystem for lions is terrestial ecosystem like desert or forest or grassland.
The historic widespread nature of lions shows they can live in many types of ecosystem, as long as there is only limited human contact and plenty of prey and space.