Legal? It's a medical examination by a Doctor. They do the same in civvy medical examinations if they suspect hernia.
However, under 16 you must have parental consent to undergo the recruiting process and you can request a chaparone (as can female candidates).