Sex harassment, including unwelcome texts, physical contact and bullying, exists at big and small law firms, a survey of mostly female lawyers in Massachusetts shows.

The survey was conducted by the Women’s Bar Association of Massachusetts and the Rikleen Institute for Strategic Leadership amid the #MeToo movement that has spotlighted sexual harassment in the workplace.

The movement has claimed figures in media, entertainment and politics. But outside of allegations against a federal judge, Alex Kozinski, the legal industry has not...