The story
Based on HTML code, in which a slash indicates the end of an element (for example, </b> marks the end of bold formatting). Originally written as </sarcasm> (to mark the end of a sarcastic message) with the block of text enclosed (see < > ), this was later simplified to /sarcasm and eventually just /s.
Etymology from Wiktionary, CC BY-SA 4.0.