Ahimelech is referring to sexual abstinence. The men (and David) must not have recently slept with their wives. Under old covenant law, sexual intercourse temporarily rendered a person ritually unclean (see Exodus 19:15; Leviticus 15:18). This was because the release of bodily fluids, whether semen or blood, symbolized death.1
4 And the priest answered David, “I have no common bread on hand, but there is holy bread if the young men have kept themselves from women.”