Conditions of the Validity of Prayer
Question

What are the conditions of the validity of prayer?
Praise be to Allah.Meaning of condition
“Condition” in the terminology of usul al-fiqh (principles of jurisprudence) means that which is essential and without which a thing is not valid. 
So the conditions of prayer being valid refer to that on which the validity of prayer depends, such that if one of these conditions is broken, then prayer is not valid as a result. 
Conditions of the validity of prayer
The conditions of the validity of prayer are: 
The beginning of prayer time 
This is the most important condition. A prayer offered before its time has begun is not valid, according to scholarly consensus, because Allah says (interpretation of the meaning): 
“Verily, As-Salah (the prayer) is enjoined on the believers at fixed hours.” [al-Nisa 4:103]
Allah has mentioned the times of prayer in brief terms in His Book. He says (interpretation of the meaning): 
“Perform As-Salah (Iqamat-as-Salah) from mid-day till the darkness of the night (i.e. the Zuhr, ‘Asr, Maghrib, and ‘‘Isha prayers), and recite the Quran in the early dawn (i.e. the — Fajr morning prayer). Verily, the recitation of the Quran in the early dawn (i.e. the morning — Fajr prayer ) is ever witnessed (attended by the angels in charge of mankind of the day and the night).” [al-Isra 17:78] 
“mid-day’ means when the sun passes its zenith. “the darkness of the night” means in the middle of the night. This time, from halfway through the day until halfway through the night, includes the time of four prayers: Zuhr, ‘Asr, Maghrib and ‘Isha. 
The Prophet (peace and blessings of Allah be upon him) mentioned the times in detail in his Sunnah. 
Covering the ‘awrah
If a person prays with his ‘awrah uncovered, his prayer is not valid, because Allah says (interpretation of the meaning): 
“O Children of Adam! Take your adornment (by wearing your clean clothes) while praying.” [al-A'raf 7:31]
Ibn ‘Abd al-Barr (may Allah have mercy on him) said: 
“They unanimously agreed that the prayer of one who does not wear his clothes when he is able to cover himself with them, and prays naked , is invalid.” 
Types of ‘Awrah
‘Awrahs for people who are praying fall into several categories: 
1.      Minimum ‘awrah. This is the ‘awrah of a male between the ages of seven and ten; his ‘awrah is the two private parts only, front and back.
2.      Moderate ‘awrah. This is the ‘awrah of one who has reached the age of ten and above, between the navel and the knee.
3.      Maximum ‘awrah. This is the ‘awrah of an adult, free woman. All of her body is ‘awrah when praying, except for her hands and face. The scholars differed with regard to showing the feet.
Taharah
Taharah (purity), which is of two types: purity from ritual impurity (hadath) and purity from tangible impurity (najas). 
1.      Purity from major and minor ritual impurity (hadath). If a person prays when he is in a state of ritual impurity, then his prayer is invalid according to scholarly consensus, because of the report narrated by al-Bukhari (6954) from Abu Hurayrah (may Allah be pleased with him) from the Prophet (peace and blessings of Allah be upon him) who said: “Allah does not accept the prayer of one of you if he becomes ritually impure, unless he does wudu.”
2.      Purity from najasah or tangible impurity. If a person prays with some impurity on him, and he is aware of that and remembers it is there, then his prayer is not valid.
The worshipper should avoid najasah in three places:
1.      The body. There should not be any najasah or impurity on his body. This is indicated by the report narrated by Muslim (292) from Ibn ‘Abbas (may Allah be pleased with him) who said: The Messenger of Allah (peace and blessings of Allah be upon him) passed by two graves, and he said: “They are being punished, but they are not being punished for anything that was difficult to avoid. One of them used to walk around spreading malicious gossip, and the other did not protect himself from his urine.” …
2.      The clothing. This is indicated by the report narrated by al-Bukhari (337) from Asma bint Abi Bakr (may Allah be pleased with her) who said: A woman came to the Prophet (peace and blessings of Allah be upon him) and said: If one of us sees menstrual blood on her garment, what should she do? He said: “Scratch it, then rub it with your fingers whilst pouring water on it and continue to pour water on it (until it is clean), and then pray in it.”
3.      The place in which prayer is offered. This is indicated by the report narrated by al-Bukhari from Anas ibn Malik (may Allah be pleased with him) who said: A Bedouin came and urinated in the mosque. The people rebuked him but the Prophet (peace and blessings of Allah be upon him) told them not to do that. When (the man) had finished urinating, the Prophet (peace and blessings of Allah be upon him) ordered that a bucket of water be poured over it.
Facing towards the qiblah 
If a person offers an obligatory prayer facing anywhere other than the qiblah, when he is able to face it, then his prayer is invalid according to scholarly consensus, because Allah says (interpretation of the meaning):
“so turn your face in the direction of Al-Masjid Al-Haram (at Makkah). And wheresoever you people are, turn your faces (in prayer) in that direction.” [al-Baqarah 2:144]
And because the Prophet (peace and blessings of Allah be upon him) said, in the hadith about the one who prayed badly: “Then turn to face the qiblah and say takbir.” (Narrated by al-Bukhari. 6667) 
Intention (niyyah)
If a person prays without forming the proper intention then his prayer is invalid, because of the report narrated by al-Bukhari from ‘Umar ibn al-Khattab (may Allah be pleased with him) who said: I heard the Messenger of Allah (peace and blessings of Allah be upon him) say: “Actions are but by intentions and each person will have but that which he intended.” Allah does not accept any deed unless it is accompanied by the right intention. 
The six conditions mentioned above apply only to prayer. To them may be added the general conditions that apply to all acts of worship: one should be a Muslim, of sound mind, and of the age of discernment 
Based on this, the conditions of prayer being valid are nine in all: 
Being Muslim, being of sound mind, discernment, being free of ritual impurity, removal of tangible impurity, covering the ‘awrah, the time for that prayer should have begun, facing the qiblah and forming the right intention. 
And Allah knows best.