It is mentioned in the exegesis of the verse that one of them would see another committing a sin and would forbid him from it. Then he would meet him the next day while he was still persisting in that sin, yet he would not forbid him; instead, he would socialise with him, eating and drinking with him and sitting in his company. When Allah saw this from them, He caused their hearts to clash with one another and cursed them upon the tongues of their prophets. The Messenger of Allah warned us not to act in this way, lest the same punishment that afflicted them befall us. Allah knows best.
Question: With such people—or others who commit certain sins—is it better to associate with them and continue giving advice in the hope of reforming them, or to boycott them and avoid their gatherings altogether?
Answer: The better course is to keep advising them, unless there is a benefit in boycotting them that would make them desist. If shunning them would, for example, shame and embarrass them and is more effective in bringing them to desist, then they should be boycotted. But if the boycott brings no benefit, there are two options: either keep their company while advising, commanding and forbidding them, and if no benefit is seen, then withdraw from them and boycott them.
***
Remaining with a wife who does not pray
Question: I have a wife who used neither to perform the prayer nor to fast, nor to fulfil her religious or marital obligations. I have taught her everything, yet she still does not commit to the prayers; rather, she often abandons them and even mocks me when I instruct her to pray. What is the ruling on remaining with her, given the difficulty of marrying another righteous woman because of the exorbitant dowries that have now become a major obstacle?