A Saudi educator known for his charity work and instructing prisoners has won the $1 million Global Teacher Prize.