SOWETO, South Africa—In a far corner of the high school that was once an incubator for black South African luminaries and their children, dozens of students killed time smoking marijuana and nyaope, a crude concoction of heroin and household chemicals.

Sipho Tshabalala, an 18-year-old student, kept a close watch over the drug sellers, customers and lookouts who crowded the lawless patch of schoolyard known as the island. “You find all kinds of comedians back here,” he said on a recent morning. “You learn more than in class.”

...