Lewd once distinguished ordinary people from clergy.
Old English lǣwede included nonclerical and unlearned uses. Middle English leued continued the educational sense. Later uses turned judgemental, including coarse and lustful, leading to the familiar indecent sense.
The slots select contexts: the first two senses already overlapped in Old English. Nonclerical does not mean irreligious. The deeper origin is uncertain.
Sources
- Merriam-Webster: lewd
Word History and definitions support the ancestry and selected senses.
- Online Etymology Dictionary: lewd
The entry supplies leued, educational usage and later coarse or lustful senses; it marks the deeper origin uncertain.