Historically, the Supreme Court has held that forgoing vaccines is a threat to public health and therefore beyond the bounds of liberty.
When it comes to vaccination, the Supreme Court has fairly consistently found that mandatory vaccinations are constitutional. On this and a range of other issues, the highest court has generally found that while freedom of belief may be absolute, freedom of action is not. There is no liberty to infect others with a communicable disease, just as there is no liberty to murder.
In the perpetual balancing act of constitutional liberties, the court has typically decided that government’s duty to safeguard the health of its citizens takes priority over some individual rights.