A yellow dog contract is a pre defined agreement between an employer and an employee, as a condition for employment, where the employee cannot join a labour union. These laws are widely used in capitalist setups like the United States, where there is significant conflict between the labour unions and the management.
As per this contract, the employee will have to leave the labour union, if he is already part of one before he joins the organisation. He will have to leave the organisation if he joins a labour union. Basically, it is illegal as per law for the employer to join a trade union while he is a part of the particular organisation.
Until the 1930's in the US, employers widely used yellow dog contracts to prevent employees from joining trade unions, thus weakening the influence of such unions on their decision making process. The employees, gave in to such contracts and signed them out of helplessness. The economy of the country was not doing too well at that time and the blue collar employees were desperate for work and income. The enactment of Wagner Act in 1935 put an end to such agreements. US is a federal union. Each state has its own laws. The courts struck down the legality of yellow god contracts in states like Kansas.
This gave the employees the power to bargain collectively with the employee and put an end to the unfair trade practice of yellow dog contracts.
Above is a poster that asked the employees to not sign the yellow dog contract.