1660s, "state of being unmarried, voluntary abstention from marriage," formed in English, with abstract noun suffix -cy + Latin caelibatus "state of being unmarried," from caelebs "unmarried," a word of uncertain origin. Perhaps from PIE *kaiwelo- "alone" + lib(h)s- "living." De Vaan suggests as an alternative PIE *kehi-lo- "whole," which would relate it to health (q.v.): "[I]f this developed to 'unboundness, celibacy', it may explain the meaning 'unmarried' of caelebs-."
Originally and through the 19c. celibacy was opposed to marriage, and celibacy, except as a religious vow, often was frowned upon as leading to (or being an excuse for) sexual indulgence and debauchery among bachelors. By 1950s it was being used sometimes in a sense of "voluntary abstinence from sexuality," without reference to marriage.