The Taft-Hartley Act
Prior to the passage of the Taft-Hartley Act by Congress over President Harry S. Truman's veto in 1947, unions and employers covered by the National Labor Relations Act could lawfully agree to a "closed shop," in which employees at unionized workplaces are required to be members of the union as a condition of employment. Under the law in effect before the Taft-Hartley amendments, an employee who ceased being a member of the union for whatever reason, from failure to pay dues to expulsion from the union as an internal disciplinary punishment, could also be fired even if the employee did not violate any of the employer's rules.
The Taft-Hartley Act outlaws the "closed shop." The Act, however, permits employers and unions to operate under a "union shop" rule, which requires all new employees to join the union after a minimum period after their hire. Under "union shop" rules, employers are obliged to fire any employees who have avoided paying membership dues necessary to maintain membership in the union; however, the union cannot demand that the employer discharge an employee who has been expelled from membership for any other reason.
A similar arrangement to the “union shop” is the “agency shop,” under which employees must pay the equivalent of union dues, but need not formally join such union.
Your source is incorrect. Union membership cannot be compelled. However, employees may be compelled to pay dues.