Only for mentally ill people and possibly serial offenders; not for something like a vaccine that has no relationship to criminal conduct.
Well, it’s largely only come up in cases of antipsychotics...so far. But, the writing is on the wall that this is likely to be litigated for vaccines, soon.
Whether federal prisons could do this remains to be seen. But, since the 1905 Supreme Court ruling in Jacobson v. Massachusetts, it’s clear that police power of the state is sufficient to compel vaccination, in the eyes of the Court.
In the intervening years since Jacobson, the Court has had a few opportunities to walk it back and have passed every time.