Major key blues, for example, is open to scales such as minor pentatonic and the minor blues scale (minor pentatonic with a b5) as well as the more obvious major pentatonic choice.
The reason that minor pentatonic works over major key blues is because:
a) The b3 (minor 3rd) in the scale is a natural chord tone of the IV chord. e.g. when playing A minor pentatonic over A7, D7, E7, the b3 of A minor pentatonic becomes the b7 of D7.
b) The b3 also gives the V chord (E7 in A major key) a colorful tension that works well before resolving to the I chord.
c) Over the I chord, along with the b5 and b7, the b3 is considered one of the blue notes - the notes responsible for giving blues its distinctive "blues sound" - that sweetly dissonant quality that defines the style.
Usually, you're taught to keep your major and minor 3rds separated by key! However, major key blues is clearly an exception to this "rule" and means it's flexible enough to use scales you would also use naturally in minor keys.
As long as you "blend" this b3 into your major key licks as demonstrated in the video below, it'll sound natural...
Minor key blues, however, is not as flexible as major key - you'll want to stick to major pentatonic and its variants (e.g. Mixolydian).
For reasons beyond my understanding (we're getting into the realm of physics here!), the major 3rd doesn't have much of a useful function over minor keys, unless it's used purely as a passing tone and resolved immediately a semitone below or above.
So, in summary - over major key blues, use minor key scales as well as major.