When you abstain from sex, you're practicing celibacy.
Roman Catholic priests and nuns take a vow of celibacy, and the practice is not uncommon in other religions, too. The idea is often that sexual relations, marriage, and children are a distraction that keep you from fully devoting yourself to the spiritual life. You can also use celibacy more generally to refer to the state of being single or unmarried.