God for guidance of People of Madyan who were corrupted and aggressive sent his messenger named Hazrat Shuaeb (AS). God has talked about the divine knowledge of Hazrat Shuaeb (AS) in Quran. He says:
"وَإِلَىٰ مَدْيَنَ أَخَاهُمْ شُعَيْبًا قَالَ يَا قَوْمِ اعْبُدُوا اللَّـهَ مَا لَكُم مِّنْ إِلَـٰهٍ غَيْرُهُ وَلَا تَنقُصُوا الْمِكْيَالَ وَالْمِيزَانَ إِنِّي أَرَاكُم بِخَيْرٍ وَإِنِّي أَخَافُ عَلَيْكُمْ عَذَابَ يَوْمٍ مُّحِيطٍ ﴿٨٤﴾ وَيَا قَوْمِ أَوْفُوا الْمِكْيَالَ وَالْمِيزَانَ بِالْقِسْطِ وَلَا تَبْخَسُوا النَّاسَ أَشْيَاءَهُمْ وَلَا تَعْثَوْا فِي الْأَرْضِ مُفْسِدِينَ ﴿٨٥﴾ بَقِيَّتُ اللَّـهِ خَيْرٌ لَّكُمْ إِن كُنتُم مُّؤْمِنِينَ وَمَا أَنَا عَلَيْكُم بِحَفِيظٍ ﴿٨٦﴾"
And to Madyan [We sent] their brother Shu'ayb. He said, "O my people, worship Allah; you have no deity other than Him. And do not decrease from the measure and the scale. Indeed, I see you in prosperity, but indeed, I fear for you the punishment of an all-encompassing Day. (84) And O my people, give full measure and weight in justice and do not deprive the people of their due and do not commit abuse on the earth, spreading corruption. (85) What remains [lawful] from Allah is best for you, if you would be believers. But I am not a guardian over you." (86)[1]
Teachings of Hazrat Shuaeb (AS) was insurance and guarantee for people of Madyan, but the people didn’t heard his voice and didn’t answer to his invitation to the right and divine path. The people of Madyan were so corrupted and caught in violent desires; that’s why they could not see and find the right path. They all knew that what the value of prayers is; they knew prayer will keep them away from corruption and bad acts. They said to Hazrat Shuaeb (AS):
"قَالُوا يَا شُعَيْبُ أَصَلَاتُكَ تَأْمُرُكَ أَن نَّتْرُكَ مَا يَعْبُدُ آبَاؤُنَا أَوْ أَن نَّفْعَلَ فِي أَمْوَالِنَا مَا نَشَاءُ إِنَّكَ لَأَنتَ الْحَلِيمُ الرَّشِيدُ ﴿٨٧﴾"
They said, "O Shu'ayb, does your prayer command you that we should leave what our fathers worship or not do with our wealth what we please? Indeed, you are the forbearing, the discerning!" (87)[2]
Prayer keeps you away from bad acts, prayer guides you to the exact right path, prayer keeps you away from absence, prayer keeps you away from devil and its orders, pray keeps you away corruption and designs calms and peaceful life here and hereafter.
source : Forty Hadith by Imam Ruhullah al-Musawi al-Khumayni