First understand "damping."
A suspension with springs only, no shocks or other damping devices, will bounce and oscillate. Push it down, let go, and it wiggles back and forth past its rest point and finally settles down.
Enter the mis-named shock absorber. This device absorbs no shocks, it simply resists being moved. Originally this was done by friction, dragging a rod through a leather ring or something. Nowadays it does this by forcing fluid through an orifice. The fluid is free to move, but only as much as can be forced through the orifice. When the spring gets back to near its at-rest position, it's been slowed down enough that it doesn't shoot past and oscillate.
This resistance to moving "dampens" the oscillation of a free spring, takes the bouncy out.
Obviously the suspension moves both directions. The load squeezes the spring, and the spring pushes back to raise the load.
This is the answer to your question: compression is squeezing the spring, making it shorter, lowering the load relative to the wheels. Rebound is allowing the spring to release, making it longer, raising the load relative to the wheels.
Each direction's damping is separately adjustable on the front of our bikes. At the rear, stock shock, only rebound is adjustable, compression damping is by whatever health is left in the shock.