The primary functions of the testes are to produce sperm (spermatogenesis) and to produce androgens, primarily testosterone.