.. if a EU country decides that the vaccine should be mandatory, especially when they promised again and again it would not be compulsory, wouldn't that raise law-related problems? Is it legal?
Yes, it is legal since public health is classified as a shared competence where the European Union does not exercise its own competence and therefore within the competence of a member state to decide.
Supporting public health in Europe
EU health policy focuses on protecting and improving health, giving equal access to modern and efficient healthcare for all Europeans, and coordinating any serious health threats involving more than one EU country.
The European Union coordinated the creation and implementation of the EU Digital COVID Certificate, but it is up to the member states to decide under what conditions (and to whom) a certificate is to be issued and used. (shared competence)
Protection of health, due to experiences of the past, is often considered (depending on the jurisdiction) a major task of national governments.
During the Black death (where no vaccination was available), many countries took extreme measures to protect their population. Although the concept of isolating people to prevent the spread of disease had already existed, the term quarantine originated during this period.
Since the early 19th century (1807 in Bavaria), some countries imposed compulsory vaccinations to eradicaticate smallpox where it was deemed as a danger to the whole population.
History has shown, when faced with no other choice, a country will exercise any extreme measure needed for the benefit of their population.
Division of competences within the European Union
The EU has only the competences conferred on it by the Treaties (principle of conferral). Under this principle, the EU may only act within the limits of the competences conferred upon it by the EU countries in the Treaties to attain the objectives provided therein. Competences not conferred upon the EU in the Treaties remain with the EU countries.
- Exclusive competences (Article 3 of the Treaty on the Functioning of the European Union — TFEU) areas in which the EU alone is able to legislate and adopt binding acts. EU countries are able to do so themselves only if empowered by the EU to implement these acts.
- Shared competences (Article 4 of the TFEU): the EU and EU countries are able to legislate and adopt legally binding acts. EU countries exercise their own competence where the EU does not exercise, or has decided not to exercise, its own competence.
- Supporting competences (Article 6 of the TFEU): the EU can only intervene to support, coordinate or complement the action of EU countries. Legally binding EU acts must not require the harmonisation of EU countries’ laws or regulations.
Due to the smaller amount of Exclusive competences in important areas, the European Union is more of a Confederation than a Federation (such as Canada and the United States).