critical update this will not work for SA nationals, as of 2015. See info on the new rules here
The discussion here is basically about whether "Travel Without Visa" concession is applicable to South African citizens. The short answer is "in certain special cases".
Citizens of most countries only need to fulfill three simple requirements:
- you must arrive and depart by air;
- your onward flight must be confirmed, and must depart within 24 hours; and
- you must have proper documentation for your destination, including a visa if required.
But if you are unlucky, and happen to hold a passport of one of DATv countries (e.g. South Africa), the rules are significantly stricter: in addition to the above conditions, you have to fulfill one of the requirements from the list Doc quoted in his answer. In the case of your friends, the following condition is met, they hold:
a valid visa for entry to Canada or the United States of America and a
valid airline ticket for travel via the United Kingdom from the
country in respect of which the visa was held to another country or
Some third-party websites also state that you must depart from the airport of your arrival, but this is nowhere mentioned on the UKBA website, so, probably, is outdated.
The only thing one should be afraid of, is to be denied boarding at the airport of departure in Canada (it is ridiculous to deport your friends from LHR to South Africa if they already have tickets for a flight going there in 9 hours). Now, during the check-in procedure at the airport of departure the airport staff will check whether you have all the required travel documents (visa, valid passport, etc.). For that purpose they will probably use Timatic, an automated system similar to http://www.iatatravelcentre.com/. Just type in all the travel details there, and see what the system says. If it says yes, you will be allowed boarding.
P.S. As MeNoTalk mentioned, there are indeed cases when it is safer to have a visa. Apart from saving time (it took me around 10-15 minutes to show all the necessary documents in order go through the passport control in LHR using the "Travel Without Visa" concession, but I am not a DATv national), it is recommended if
- you have any unspent criminal convictions in any country, including
- you have previously been refused entry, deported or otherwise
removed from the UK;
- you have breached the terms of any previous entry
to the UK (for example, by working illegally or staying here after
your permission to stay expired);
- you have previously applied for a
visa and been refused; or
- you have been warned by a UK official that
you should obtain a visa before you travel to the UK.