I believe it works the same way as alum and changes the charge in the water and allows the suspended clay to settle out. With gypsum you have to use more of it but you don't have to worry about pH swings like you do with Alum.

I don't know if pH or hardness has an effect on it. I took a water sample from my pond and then put a baseball size gypsum rock in it. The sample cleared up in less than two days.