The following information is for EU/EEA/Swiss students in the UK before 31 December 2020:
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. From October 2017, doctors' (general practitioners') surgeries in England are likely to check new patients’ eligibility for free NHS secondary care by asking to see an EHIC (where appropriate), even though general practitioners' services remain free of charge.
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.
These arrangements will continue until 31 December 2020 for EU, non-EU EEA and Swiss citizens coming to the UK. The UK negotiated separate agreements with the EU, EEA EFTA states and Switzerland before the UK left the EU. These agreements have in place some protections for those who are in the UK before the end of the transition period and want to remain after the end of the transition period.
Healthcare is a devolved matter, which means each country in the UK (England, Northern Ireland, Scotland and Wales) has its own regulations outlining who is charged for healthcare in that country, but the whole of the UK must abide by the negotiated agreements.
Each country has produced guidance outlining when there is continuing eligibility to free healthcare after the end of the transition period:
England (with further information here)
It is important that until an application under the EU settlement scheme is decided (if you are eligible to apply, and will apply), you have comprehensive sickness insurance while you are in the UK as a student in order to be in the UK lawfully.