On the origin of the term:
I reckoned that the origin of the term might be the International Women's Day, or 三八节, but I changed my mind later because it doens't explain the term's popularity in Cantonese and Taiwanese.
With a little research, I think the term might have multiple origins, at least three. In Taiwanese Hokkien, the slang Sam-Pat actually preexisted the International Women's Day. The slang refers to a snobbish, prima-dona like girl, and it might be the archetype. Check this, and this.
In the meantime, in Cantonese, Ba Po (八婆) refers to a gossiping and spiteful woman, almost sharing the same meaning as modern term San Ba. Linguists speculate that the Taiwanese term Sam-Pat later on spread to Hong Kong and was adopted by Cantonese speaking people to be interchangeable with Ba Po, due to the similarity between the two terms. Check this.
And finally, the International Women's Day, mostly celebrated in mainland China, happens to take place on March 8, and it could be the third origin of the term.
And I do think the term is a sexist insult, and strongly encourage people not to use it, but at the same time it might be worth of knowing it.
Again, the term is differnet from an insult like c**t. It's just a number, after all, and doesn't even refer to any part of a human body, which makes me feel that it isn't yet a crime to mention it.