Most students are able to obtain a European Health Insurance Card (EHIC) from their country of residence prior to coming to the UK. This card allows EEA nationals to get the same medical treatment, which is free to residents of the country they are visiting, without being charged. The UK government has produced a leaflet about EHIC and access to medical treatment while in the UK.
In addition, if you are exercising your right to reside in the UK as a student or self-sufficient person, you are required to have comprehensive sickness insurance throughout your period of residence in the UK. Having an EHIC satisfies this requirement if you are not intending to be in the UK permanently.
It is important that you obtain this card before you leave your country of residence. If you have lost or forgotten your EHIC, you may be able to obtain a 'provisional replacement certificate'. This document is equivalent to the European Health Insurance Card. The website of the European Commission says:
It acts as a replacement if the European Health Insurance Cardholder has lost or forgotten his Card, or if the sickness insurance institution is unable to issue the applicant with a European Health Insurance Card prior to his departure. It has the same value as the European Health Insurance Card.
You cannot apply for this card in the UK and without it you could be charged for using the NHS unless you have alternative, adequate medical insurance.
If you want to learn more about using your EHIC, use this app in 25 languages.
Every member state of the European Economic Area provides information about how to apply for an EHIC in that country.