Saturation is roughly the difference between max(r,g,b) and min(r,g,b). I.e. in a rgb color space 0-1.0, a saturated blue is b=.9, r=g=0.1. A pale blue has b=0.9 r=g=0.7.
If you enhance contrast in the r,g,b space the saturation will be affected. This is the fastest way to compute contrast change. Increasing contrast is to move (either by s curve or contrast slider) values below 0.5 further down, and values above 0.5 further up, and vice versa for lower contrast. This is done to each color channel independently. So the b 0.9 becomes 1.0 and r=g=0.0, now a difference of 1.0 versus 0.8 before. The difference between max and min is thus higher. The pale blue has both the max and min color channel value go up to maybe clipping at b=1.0 and r=g=0.95 , a difference of 0.05 versus 0.2 before.
Also gamma changes the relationship between the channels, so it will affect the saturation.
Now, instead of applying contrast change to RGB values, we can convert the color space to YUV, LAB, or HSV/HSI where we separate the brightness from the color. Then we can change gamma and contrast without changing color. Complexities arise with human perception that the perception of colors and saturation changes with brightness, and the monitors and prints also undergo transfer functions that affect these things. So the formulas are not perfect. the XYZ->LAB tried to take this into account, but it takes a lot of processing to convert one way and then back again to display the result.