When I add dish soap to a sponge it is able to foam up. But if I leave the sponge alone for an hour, it doesn't foam up, not even if it is wetted.
Why? The sponge should still contain dish soap an hour later.
Tap water contains calcium and magnesium ions; more so if the water is hard. These ions can bind to soap over time and make an insoluble soap curd.
Is the sponge clean? If not, another reason is that the surfactants in the soap that make the foam might be forming micelles around whatever grime is in your sponge, so that there aren't many left to make the foam.