The timing of STI tests depends on the specific infection and the individual's risk factors. For example, routine screening for chlamydia and gonorrhea is recommended annually for sexually active women under 25 and older women with risk factors. Pregnant women should be tested for syphilis, HIV, and hepatitis B early in pregnancy.