Is it permissible for him to trim his beard so that he will not be exposed to harm?
Question

                My friend is going to get married in an Islamic country. Alhamdillah he is a practicing Muslim ( May Allah taala guide us all) and observes the sunnah of "leaving the beard". In this country where he is going, those with long beards are detained (especially those of Pakistani origin) at the airport and the secret police often follow them. He does not want to cause hardship to his wife's family, who are likely to be followed and harassed by the government. Therefore, he wishes to trim his beard slightly just for this occasion and grow it back. If not for the possibility of bringing hardship to his in-laws he would not want to trim. Please advise .
Praise be to Allah.
    Letting the beard grow is obligatory according to sharee’ah, 
    and shaving it is haraam. In the answer to question no.
    1189 we have stated the ruling on 
    shaving the beard, and that shaving it is a haraam action. 

    Ibn Hazm (may Allaah have mercy on him) narrated that the 
    scholars are unanimously agreed that it is not permissible to shave the 
    beard. 

    Al-Muhalla, 2/189 
With regard to shaving 
    it for fear of persecution or exposure to harm, this fear is not all of one 
    level.  In some cases it may be what is likely to happen, and in other cases 
    it may be imaginary, and in yet others it may be six of one and half a dozen 
    of the other.  

    It is not permissible for him to shave his beard or trim it 
    except in cases where harm is likely to result, and it is not permissible in 
    any other situation. 

    This comes under the heading of cases of necessity. Allaah 
    says (interpretation of the meaning): 

    “But if one is forced by necessity without willful 
    disobedience nor transgressing due limits, then there is no sin on him. 
    Truly, Allaah is Oft-Forgiving, Most Merciful”

    [al-Baqarah 2:173]

    Or in cases of compulsion. Allaah says (interpretation of the 
    meaning): 

    “Whoever disbelieved in Allaah after his belief, except 
    him who is forced thereto and whose heart is at rest with Faith; but such as 
    open their breasts to disbelief, on them is wrath from Allaah, and theirs 
    will be a great torment”

    [al-Nahl 16:106]

    Force or compulsion means that he will be harmed if he does 
    not shave it. As for simply experiencing some annoyance or questions or 
    investigation, these are things from which those who do shave their beards 
    are not necessarily safe, so that does not mean that a person is permitted 
    to fall into sin. 

    In cases of compulsion, there are conditions which must be 
    met in order for it to be permissible for a Muslim to be granted the 
    concession of doing or saying something that is haraam. Understanding what 
    these conditions are is very important, because many people are claiming 
    that they are forced to do things when that is not the case. 

    Ibn Qudaamah said: 

    The conditions of compulsion include three things: 

    1 – That the one who is trying to force you has power to 
    cause harm

    2 – That he thinks it most likely that the threat will be 
    carried out if he does not do what is being demanded of him

    3 – That the harm be severe, such as being killed, beaten 
    severely, tied up or imprisoned for a lengthy period. As for being insulted 
    or cursed, this is not compulsion, and neither is taking a small amount of 
    wealth. 

    If the person is of low status, a little harm may not be 
    compulsion in his case, unlike those of high position for whom a little harm 
    may be a humiliation and it is like a severe beating for someone else who is 
    of lower status.
If there is a threat of 
    torturing his child, this is not compulsion, because the harm is being 
    directed at someone else. But it is more likely that this is compulsion, 
    because that is worse for him than taking his wealth; that threat (to take 
    his wealth) is compulsion, so the same applies here. 

    Al-Mughni, 7/292 

    If the harm can be warded off by trimming the beard, then he 
    should not shave it off, rather it is sufficient to trim it, because shaving 
    is worse than trimming. It should be noted that a person should have the 
    need to undertake this journey to that country. But if there is no need for 
    that then it is not permissible to shave his beard for the sake of 
    travelling, because he is not being forced to do that. 

    And Allaah knows best.