Most bilaterian animals excrete toxic metabolites through specialized organs, such as nephridia and kidneys, which share morphological and functional correspondences. In contrast, excretion in non-nephrozoans is largely unknown, and therefore the reconstruction of ancestral excretory mechanisms is problematic. Here, we investigated the excretory mode of members of the Xenacoelomorpha, the sister group to Nephrozoa, and Cnidaria, the sister group to Bilateria. By combining gene expression, inhibitor experiments, and exposure to varying environmental ammonia conditions, we show that both Xenacoelomorpha and Cnidaria are able to excrete across digestive-associated tissues. However, although the cnidarian
Nematostella vectensis
seems to use diffusion as its main excretory mode, the two xenacoelomorphs use both active transport and diffusion mechanisms. Based on these results, we propose that digestive-associated tissues functioned as excretory sites before the evolution of specialized organs in nephrozoans. We conclude that the emergence of a compact, multiple-layered bilaterian body plan necessitated the evolution of active transport mechanisms, which were later recruited into the specialized excretory organs.