Water helps them defecate, but they will also poop in the dirt if they choose to. There's nothing wrong with a frog pooping on dirt; the water is just easier to clean because then you can change the water and put it back in.