Various ages depending on time and location and role.
Formally, all students in school above the age of 12 were instructed in military martial arts beginning in 1917ish.
Men from Japan proper could join the military after high school in the early 20th century. However, many of the imperial armies ran on their own rules and didn’t formally answer to Tokyo.
By the end of the Pacific War, boys as young as 12-13 were enlisted as pilots or soldiers in Japan proper.