Answer:
When he remembers, he should perform wudu or ghusl and pray again.
Sayyiduna Abdullah ibn Umar (may Allah be pleased with him) narrates that the Messenger of Allah ﷺ said:
لا تُقْبَلُ صَلَاةٌ بِغَيْرِ طُهُورٍ .
“No prayer is accepted without purification.”
Reference: Sahih Muslim: 224