In Suratul ’Ankabut, verse number 45, mentions an important philosophy with respect to the prayers when it says:
إِنَّ الصَّلاةَ تَنْهى عَنِ الْفَحْشَاءِ والْمُنْكَرِ
“Surely prayer keeps (one) away from indecency and evil.”
Since prayers remind man of two of the most powerful deterrents - the Origin and the Resurrection - it thus possesses a deterring influence with regards to indecency and evil.
A person, who stands up for prayers, recites Allahu Akbar and regards Allah to be superior to and greater than everything else. Recollecting His bounties, he praises Him and offers his thanksgiving. He eulogizes Him for His Compassion and Mercy, and brings to mind the Day of Judgment; professing his servitude, he yearns for His help, seeks the Straight Path from Him and implores Him to protect him from treading the path of the deviated ones and those, who earn His anger (the theme of Suratul Hamd).
Undoubtedly, the heart and the soul of such a person shall experience an impulse towards truth, purity and piety. He goes into ruku’ for Allah and places his forehead on the ground in His august presence. Drowned in His grandeur, he shoves his egoism and superiority complex into oblivion.
He testifies to His Unity and the prophethood of the Noble Prophet (s.a.w). He sends salutations upon the Noble Prophet (s.a.w) and beseeches Allah to place him amongst His righteous servants (tashahhud and salam).
All these acts create within him a tidal wave of spirituality, which is reckoned to be a strong barrier against sins. This act is repeated several times in a day; when he rises up in the morning, he gets immersed in His remembrance; in the middle of the day when he is totally engrossed in the material life he suddenly hears the muezzin calling the people to prayers. Interrupting his schedule, he hastens to present himself before Him. Even at the end of the day and before sliding into the relaxing comforts of his bed, he engages himself in a communion with his Lord, illuminating his heart with His Light.
In addition to the above, as he engages himself in the preliminaries of the prayers, he washes and cleans himself and keeps away usurped and forbidden things from himself after which he proceeds to present himself before his Friend. All these things effectively serve as a deterrent, preventing him from treading the path of indecency and evil.
But ultimately, every prayer shall only keep one away from evil and indecency in the same measure as the conditions of perfection and the spirit of worship, which it happens to possess. At times, it keeps one away from evil, completely and wholly, whereas at other times it does so partially and incompletely.
It is impossible that a person offers his prayers but they do not have any effect on him - however superficial the prayer and however polluted the person. Obviously, the effects of such prayers are less, but had such individuals not been offering these prayers, they might have been in a much more polluted state.
Stating this more clearly, ‘refraining from indecency and evil’ possesses numerous levels and ranks, and every prayer, depending upon the conditions of the prayers that have been taken into consideration (while offering it), possesses some of these ranks It has been reported in a tradition that a youth from the Ansar (Helpers) used to offer his prayers with the Noble Prophet (s.a.w), but despite this, he was prone to committing sins and evil deeds.
When this was brought to the notice of the Noble Prophet (s.a.w), he said:
إِنَّ صَلاَتَهُ تَنْهاهُ يَوْماً.
“His prayers deter him for one day (only).”
This effect of the prayers is so significant that some of the traditions refer to it as a gauge for distinguishing the accepted prayers from those that that are not. As Imam as-sadiq (a.s) said:
مَنْ أَحَبَّ أَنْ يَعْلَمَ أَ قُبِلَتْ صَلاَتُهُ أَمْ لَمْ تُقْبَلْ فَلْيَنْظُرْ هَلْ مَنَعَتْهُ صَلاَتُهُ عَنِ الْفَحْشَآءِ والْمُنْكَرِ فَبِقَدْرِ مَا مَنَعَتْهُ قُبِلَتْ مِنْهُ.
“One, who desires to know if his prayer has been accepted or not, should observe if it has kept him away from indecency and evil, or not; the measure in which it has kept him away (is the measure of his prayer that) has been accepted.”
Continuing with the verse, Allah says:
ولَذِكْرُ اللٌّهِ أَكْبَرُ
“The dhikr (remembrance) of Allah is superior and more virtuous.”
The apparent meaning of the above sentence appears to mention a more important philosophy for the prayers. It mentions another effect of prayers - an effect that is even more important than ‘keeping one away from indecency and evil’ - and that is, it causes man to remember Allah - this being the basis of every goodness and the foundation of all felicities. In reality, its superiority and importance is due to the fact that it is the cause for it (keeping one away from indecency and evil).
Source:
180 Questions Enquiries About Islam
[Volume One: The Practical Laws, Pg. 24-26].
Ayatullah al-`Uzma al-Hajj ash-Shaykh Nasir Makarim Shirazi
The Islamic Education Board of the World Federation of Khoja Shia Ithna-Asheri Muslim Communities.