If you wish to study in Germany you need health insurance. Without it, you cannot be enrolled. So, as soon as possible after your arrival, you should take out health insurance.
You are obliged to insure yourself until you are 30 years old, or until your 14th study term. At worst case, if you do not have insurance you could be barred from studying.
Many Studentenwerke offer Servicepakete for international students which, besides accommodation and meals, may also contain health insurance.
In Germany there are two kinds of health insurance, compulsory/public and private. Basically, up until you are 30 years old or until your 14th term of study you must have compulsory health insurance. Private health insurance is only allowed in exceptional cases. Please note: once you take out private health insurance you cannot revert to public health insurance!
In most cases the public health insurance is the more reasonably priced version anyway - unless you are covered by your parents' private health insurance.
You can get more advice from the social help desks in the Studentenwerke or the academic international offices at the universities.
With some countries, such as members of the European Union and the European Economic Area, Germany has a social security agreement. As long as you have public health insurance at home you can get this insurance coverage approved by a public health insurance company in Germany. But make sure you clarify at home which documents you will need to take with you! For students this is usually a European health insurance card (EHIC).
Your insurance company will usually issue the EHIC free of charge.
It is possible that your insurance will not cover all costs in Germany. Before you enter the country make sure you know exactly what services you are entitled to in Germany. If you do not have health insurance at home, you still have to insure yourself in Germany - just like all other students.
Sometimes private health insurance from other countries may also be recognised in Germany. You should clarify the exact details with your insurance.
If your private health insurance is recognised then for the purpose of your enrolment at university you will need confirmation that you are exempt from taking out public health insurance. But be aware that for the duration of your studies you cannot change to public health insurance!
With which countries does Germany have a social security agreement?
The European health insurance card already exists in 30 countries
Social security agreements exist with other countries, too.
The Federal Ministry of Labour and Social Affairs provides more information
After your 30th birthday or your 14th term of study you can no longer get public health insurance at the favourable student rate. However, some public health insurance funds do offer tariffs for graduates which grant cheaper rate health insurance for one extra term. You can also take out voluntary health insurance with one of the public health funds.
Private health insurance is the other option. This applies particularly to students who are already 30 when they begin studying in Germany.
Whoever takes part in a language course in preparation for their studies cannot get health insurance from a public health fund. In this case you must opt for private health insurance. Once the language course has been completed students who are younger than 30 can change to the public health insurance for the duration of their studies.
The regulations for preparatory colleges vary. The best thing to do is to contact the preparatory college of the university where you would like to study later on.