Why did Congress pass the Civil Rights Act of 1866?

Why did Congress pass the Civil Rights Act of 1866?