It is not mandatory, however recommended. If you use an EHIC to get medical care, some insurers won’t ask you to pay the excess on your medical claims. The EHIC might not be enough on its own though. You are recommended to still get travel insurance that includes medical and repatriation cover.
Travel insurance often also cover theft, loss and failure of a travel company.
There are a wide variety of policies, and some policies specifically exclude ‘dangerous activities’, which can include scuba diving, motorcycling, winter sports, adventure sports or even hiking. So check the small print!