It is either solvent-compound interaction or chemical reaction between the compound and solvent such as acid-base interaction. Solvents have different acid/base properties and this may protonate or deprotonate your compound.
If the trasition is the type n---pi*, as a rule, increasing the polarity stabilises the lower state of the transition, then a blue shift is observed. Non polar interaction would do an opposite efect in the interaction yieldinig a red shift observation.
In case of twisted intramolecular charge transfer (TICT), a blue shift can be observed after certain polarity. Initially with increase in polarity, red shift is observed due to stabilization of charge transfer state and increase in twist in the molecule but upon further increase in solvent polarity, very large twist angle breaks the conjugation and blue shift is observed.