Compression is probably the most misunderstood, yet most consistently used effect in music. Play any rock album going back 70 years and you're more than likely to hear compression, whether from a console, a tube amp, tape, a pedal, or an outboard unit like a Fairchild 660.
The most common definition of compression is something along the lines of: "it makes loud sounds quieter and quieter sounds louder." This is really only half true. Compression does make all sound above a specific threshold quieter, but makeup gain is what brings the entire compressed signal up. Many musicians use their compressors as limiters - in other words, they put them at the end of their signal chains in order to prevent their volume from spiking when using other effects (like fuzzes or octaves) and overwhelming other band members or damaging their speakers. This isn't really the use I'm talking about here - my interest is more in using a compressor to shape tone.
To really understand compression you have to learn how to hear it. It's a subtle effect. Think about each individual plucked note as two separate pieces - the transient and the sustain. The transient is that loud, clicky, brief moment when your finger, or your pick, strikes the string. (I'd recommend trying this out with a pick, since a picked transient is far more dramatic.) The sustain is the quieter, steadier ringing out of the note as the string gradually stops vibrating.
The attack of a compressor acts in milliseconds, so when you play through one, what you're doing is shaping the transient every time you strike a string. When your signal crosses the threshold, a fast attack will squash the transient almost immediately, while a slow attack will let some of it through before ramping up the gain reduction to whatever ratio you set. Once your signal drops below the threshold, the release is the speed at which the compressor "lets go".
When you're playing through an amp, especially one with little headroom, the preamp might distort at your transients - that distortion is compression. When you record to tape, think about your loudness as equivalent to the physical width of the waveform being printed to the tape - if those peaks reach beyond the edges of the tape, those edges will flatten your signal, and that flattening will manifest as distortion (or "saturation"). Since you can't physically get any louder, that distortion is compression. Too much volume and your waveform will be a long, distorted rectangle the exact width of the tape.
I'm sharing two of my favorite compressed bass tones below as references. Herbie Flowers possibly played on both but the truth of that is lost to time. I think the Walker track is a picked Burns Bison with flats - the Gainsbourg track might be the same. The compression might come from the amp, or the console, or something else. Listen to the richness of the pick attack, the saturation of each note, and the blending of the transient release into the sustain. Then try and figure out how you can match that tone, or the tone of another reference, by using whatever gear it is you have.