There's a few established Roles in a group. Each class either covers one role exceptionally well, or the class will cover multiple roles. The roles that are the most sought after though are the Main Tank, Main Healer, and Crowd Controller.
The main job of the main tank is to gain the attention of the mobs. The key things for a tank to have is high survivability. This usually means a main tank requires high health and high armor in order to take a beating. Also as important is the ability to generate a lot of aggro from the mobs. It does no good to have a durable player of which no mobs choose to attack. This ability to generate aggro depends on the skill set of the class and damage the class does.
Off Tank / Aggro Manager
The main job of the off tank is to become the tank for the mobs who leave the main tank. So if the main tank has 5 mobs on him and one mob leaves the main tank to attack another party member, it is the job of the off duty to grab the aggro from the main tank and allow the mob to attack him while the main tank works on reestablishing aggro. Generally the Off-Tank needs to protect the priests and mages.
In addition to the classes listed for main tanking, Shaman and Hunters are good off tanks as they have mail armor and some high aggro attacks, ideal for distracting mobs until the tank can regain aggro
The main healer's job is to keep the Main Tank alive. The main healer can heal other players in the party, but only if the main tank is not in danger of death. Normally, it is desired to have a Main Healer who can also resurrect the party. Also it is beneficial for the main healer avoid grabbing too much aggro through healing.
The secondary healer's job is to provide healing to sources other than the Main Tank (which is the Main Healer's job). The Secondary Healer should not be healing the main tank unless absolutely necessary (as in the main healer is oom as it will throw off the Main Healer's rhythm.)
Crowd Controller (CC)
This player helps manage crowds by taking them out of the battle. Fighting 5 mobs at once is much more difficult than fighting 3 mobs then 2 mobs immediately after. Many classes have crowd control (cc) spells, but many of them are specialized.
Mages and Hunters are brought for crowd control since they can and , respectively. Rogues, Druids, Priests, and Warlocks are less desirable because their crowd control techniques are much more situational.
Damage Dealers (DPS)
Damage Dealers are the party members who kill the mobs the tank is tanking. Most classes can fill this role. Most restrictions on damage dealers is created by their players. All damage dealers should know how to manage their DPS while killing a mob as quickly as possible. Too high of a DPS can cause a damage dealer to pull aggro causing the mobs to attack them. While most classes have a way to lower aggro there is always a chance it won't save you.
All classes can effectively fill the role of damage dealer.