First of all it is important to understand what the term 'excommunication' means before we can address its impact on different social groups in the Middle Ages.
"Some particularly grave sins incur excommunication, the most severe ecclesiastical penalty, which impedes the reception of the sacraments and the exercise of certain ecclesiastical acts, and for which absolution cannot consequently be granted, according to Canon Law, except by the Pope, the bishop of the place, or priests authorised by them." (Catechism of the Catholic Church).
Excommunication is always conferred automatically by the a person who sins in some grave way, indeed, Catholics are continually excommunicating themselves by committing such sins as, using contraception, murder etc. The more interesting excommunications are the ones that are officially and solemnly pronounced by a bishop or the pope. These ones take place using a special ritual formula. There is another form which is used against whole communities which is called an interdict. An interdict is the same as a regular excommunication only that it applies to a whole community, diocese or country.
In 1208 Pope Innocent III placed the whole of England under interdict after John refused to accept the pope's appointment of Stephen Langton as Archbishop of Canterbury. Under the interdict the clergy were barred from administering the sacraments (excluding baptism, Last Rites and confession). So this meant that the people of England could not get married, attend Mass or receive a Christian burial. Even today this would create great anguish for people, in the Middle Ages it was considered far more severe. Eventually King John was excommunicated in 1212, additionally the pope declared that his subjects no longer owed him allegiance. The interdict was eventually lifted in 1214. In this example we can see the effects of excommunication on all ranks of society since it applied to nobles, clergy and commoners alike. John had tried to coerce and bribe clergy into breaking the interdict, but they held strong and remained loyal to the pope. Interestingly, in 1955 Archbishop Joseph Rummel placed an interdict on an American diocese who had refused entry of a black priest into a chapel there. Excommunication is not something that is peculiar to the Middle Ages!
Hope this was of some help.