They occupied a similar ecological niche to the modern hippopotamus and the related early proboscid Moeritherium, feeding on soft, aquatic plants in marshy environments. The Numidotheriidae are not believed to be direct ancestors of modern elephants, but a collateral branch.
These animals were similar to modern hippos and related proboscideans in their diet and habitat, but they weren't direct ancestors of elephants. They represent a different evolutionary line within the group.