The background is the outbreak of the coronavirus in China. Many infected people have been isolated to prevent the spread of the virus. However, medical resources are highly deficient in serious regions, leaving many patients untreated (or badly treated). Under this circumstance, is it just to isolate them?
Questions about whether a certain action is "just" tend to be maters of opinion, politics and philosophy, but it can be addressed from the perspective of legal theory (especially following the model of common law, where legal principles are based on concepts of just and proper action). Whether or not a certain action is actually legal in a certain jurisdiction depends on the laws of that country -- I suspect that the answer is different for the US versus China.
The first question would be whether those government officials have the legal authority – I assume they do. Such authority is generally governed by some specific circumstances, for example, "poses an imminent and grave threat to public health". It is basically not a legal question whether quarantining in the face of this viral threat is necessary from a public health perspective, that is a medical question. What the law would say is that if this is a serious threat, then a person's liberty can be curtailed to a limited extent, because a person does not have the right to harm others because they don't want to do some thing that protects the rights of others (be vaccinated, stay in quarantine until it is safe). However, principles of legal justice also say that the government's response should be proportionate, e.g. shoot-on-sight in response to a sneeze is not proportionate.
Quarantining has long been recognized as a valid, just and legal response to such extreme medical threats. Historically speaking, quarantining used to be the only effective action that a government can take against e.g. smallpox, plague, Spanish flu, Ebola.