The prevailing opinion is that they emerged in the early second century BCE either as a response to the oppression of the Seleucid period or the continued Hellenization under the Hasmonians when the High Priesthood was usurped by a non-Zadokite. An hypothesis that intrigues me has been offered by Fr. Jerome Murphy-O'Connor of the Ecole Biblique in Jerusalem. Relying strongly on clues in the text known as the Damascus Document, Fr. Some of the group may have returned to Judea during or shortly before the Maccabaean revolt.
CD presents an historical account that ends with the exile.
Since much of the legislation in CD governs a Jewish community among non-Jews, CD may hail back to more ancient times to the community living outside of Palestine and the Essenes may have existed long before the Teacher of Righteousness. It may be reasonable to assume that some of the older texts of the DSS were brought to Palestine from Babylonia by these returnees. It appears, however, to have become codified for any invader of oppresser from the sea to the west and was later applied to the Romans. The debate continues.