Imam explains the matter in his famous book "an exposition on Forty Hadith" as following:
In fact, this is true of all acts of worship (ibadat), and one of the main secrets of worship and the repetitive character of its acts is becoming, to become the reality of worship itself, and the changing of the inner being and the heart into the sacred form of worship.
And it is stated in a tradition that 'Ali, may peace be upon him, is the prayer and the fast of the faithful
This impact (of worship) on the heart and the associated inner becoming is better achieved during youth, for a youth's heart is gentle and simple and its purity is greater.
Its preoccupations are fewer and he is encumbered with fewer conflicts and pressures.
Therefore, it is strongly passive and receptive. Every fair and ugly trait enters the youth's heart with greater ease and receptivity and is affected by it more quickly and strongly, Imam Khomeini further explained.
It happens very often that the youth accepts truth or falsehood or something good or evil by mere intercourse with people and without requiring any proof or reasoned argument. Hence it is essential for young people to be watchful of the character of those with whom they associate and keep company and to refrain from bad company, even if they should have a firm faith.
Rather, the company of sinful and immoral persons and evildoers is harmful for all classes of people, and no one should be too confident of himself and proud of his faith, morals and conduct. Hence sacred traditions forbid everyone from associating with habitual sinners.
Read more: