If you are aware of the existence of impurity, and you know that prayer is not valid with it, but you neglected purification, then you must make up for it.
But if you are ignorant of the invalidity of prayer, and you are excused in your ignorance, then it is not necessary to make up for it