There are couple of differences between law/medicine and tech which makes attracting women to tech jobs more challenging. I will do here some generalisations, I know there are exceptions.

The traditional job of women in the household was care taking and value transference, meaning the husband brought the money and the woman distribute it and used it. That's why it was only natural for women to work in care taking jobs like medicine, teachers, social worker and such. Jobs like law or banking are value transference, they move money from one person to another without creating any real physical value. Tech generates value so it is subtly but determinately different from what women used to do before going into the work force, it was always the men domain, at least conceptually.

Medicine and Law are very certificate oriented jobs, they are safe jobs. The moment you got the certificate and got into the system you can practice and the experience you accumulate usually path your way to a better position.
Tech is something that is valued by your results and innovation, you can be a programmer without any certificate, you must learn new things endlessly and your experience amount to almost nothing when your specific knowledge become obsolete.
Women are not innovators in any fields, even in art and music, they hardly create new companies in any field. Law and Medicine doesn't require you to create anything new, you just slot in to the system, the tech world is all about innovation and new value creation.

In the western world women have options and they can do whatever they want. If they are smart and has good intuition, they would rather be lawyers or doctors, if they are not smart they would rather be a teacher and have a stable job for life with benefits.
In non western countries like India, Russia or even Israel you will find more women in tech roles because there are not too many other options to earn decently and government jobs like teaching don't pay much. If you give women the options they will go after their hurt, which is not in tech.

Women are attracted to doctors and lawyers and want to be in this environment. That's why you had countless of shows about law and medicine featuring the George Clooneys of the world. Compare it to the IT Crowd and you got a very solid reason why those jobs attracted women in the first place. Women want to be around the highly valued guys of their high school and the same go for society in general. An average white woman will never date an Indian software engineer, that's the sad reality. Women started to look at the tech world only after its status was elevated a bit, they will still rather have a doctor husband over some geeky tech guy, all else being equal.

Bottom line, tech people are not different to any other industry in the way they treat women or minorities or any other group in society. If anything bankers, lawyers, movie producers and to less extent doctors are much more status and class oriented. They invented sniffing coke from strippers butt cracks long before Mark Zuckerberg got his first kiss from his average looking wife. Still a woman will rather work in those environments than in tech from the reasons mentioned above and it is not going to change.