Firstly, an empty seed will never sprout, and prayers without presence of heart is like an empty seed.  Prayers are the cause of people staying away from sedition only where it is with the presence of heart, otherwise the movements of your lips and body have no special virtue.

If schools and universities give lessons to people which help them grow, it does not mean that every individual that goes to educational institutes will benefit and grow, but rather it means that these institutions are the grow beds for people to go and learn with the condition that they take their studies seriously and that they understand what it is they are studying.

Prayers, if performed with its conditions and doctrines applied, will impede shameful and unjust deeds.

{إِنَّ ٱلصَّلَوٰةَ تَنْهَىٰ عَنِ ٱلْفَحْشَآءِ وَٱلْمُنكَرِ}

For Prayer restrains from shameful and unjust deeds([1]).

Secondly, if someone that prayer’s commits an offence, that same person would be committing greater offences had it not been for their prayers, because the need to perform prayers correctly requires pure clothes and a pure body, clothes and the space in which you pray need to be not ones taken from others, and even this little attention given to rules and regulations of prayers is cause for the distancing of that person from unlawful and sinful deeds, just like when one wears white clothes, you would refrain from sitting on an unclean surface.

[1] Ankaboot 29:45