These are agreements between employers and unions.
In a closed shop agreement, the employer agrees that he will only hire employees who are members of the union. If an employee ever leaves the union, the employer must fire the employee. Closed shop agreements are prohibited by national law (called the Taft-Hartley Act) in the United States.
Union shop agreements allow an employer to hire non-union members but require the employee to join the union within a certain amount of time (usually after 30 days). In practice though, employers are not allowed to fire employees who refuse to join the union, provided the employees pay dues and fees to the union.
Agency shop agreements require employees who do not join the union to pay dues and fees.
Some states enacted so-called “right-to-work” laws. These laws prohibit both union shop and agency shop agreements.