Yes this is legal. If a worker does not want to pay this, then they can find emoplyment elsewhere. A business can set the terms of its hiring policies much as it sees fit, absent some form of legally actionable discrimination. Also, such an action must not violate the terms of any employment agreement, etc. that may apply.