The number of unwanted sexual contacts in the armed forces has risen by 38% in two years.