Unions are associations between two or more individuals based on a common principle, i.e., marriage, i.e., labor union, i.e., republican government.
Under capitalism, all unions, like all relationships, are voluntary as opposed to coercive/involuntary and operate under the right to free-association and the freedom to contract.
For example, a marriage where the couple loves each other vs. a “shot-gun” arranged marriage where one or both of the individuals do not wish to get married. Or, a voluntary labor union where members are to free to join or leave vs. a closed union shop where the government grants the labor union powers to draft workers and/or forcibly exclude them from working as “scabs.” Or, the representative government of a free society vs. the totalitarianism of a socialist dictatorship.
Capitalism is not against marriage, labor unions, or government as long as such unions are voluntary (uncoerced) — that is, no initiation of physical force is involved.