A prayer performed without the required ritual purification becomes valid merely because the person forgot.

The 27 Requirements for Valid Prayer: Purity and Covering