According to religious teachings, religious duties are contingent upon one’s free will and choice, meaning that if one does something out of free will, he will deserve to be rewarded or punished. It is on this basis that one of the cases of exemption from religious duty in Islam is when one is under compulsion and forced to do something. In the case of a Muslim committing an act that he wouldn’t do in normal circumstances if he wasn’t forced, such as listening to haram music, such a sin is lifted from him. Of course, one shouldn’t do something to have no choice but to go to such gatherings and needs to abstain from them as much as possible, but if it ever happens that one has no choice but to attend, according to the view of the maraje’, no sin will be written for him.
Here we would like to draw your attention to the verdicts of the maraje’ in this regard:
Gatherings in Which Music is Played
Question 248: In the case of us having no choice but to attend a gathering in which we have to tolerate mutrib and lahwi music, have we sinned?
All of the maraje’: If there is a chance of it having any effect – if all the conditions are met – you must practice nahy ‘an al-munkar (forbidding evil). If they don’t heed – if your presence there entails listening to the music or is considered supporting the rest in their sin – leave the gathering, unless your departure causes serious problems. In this case [meaning in the case of there being serious problems], staying there as much as is necessary is permissible. However, if possible, you must try not to listen to the haram music, and if you hear it undesirably, it is okay [please pay attention that there is a difference between listening and hearing].[1]