Is cyber insurance compulsory for law firms?

No, cyber insurance is not compulsory for law firms.
Only professional indemnity insurance is compulsory.
Although there can be some overlap, cyber insurance and professional indemnity insurance are different types of insurance.