Constitution Changes have Retroactive HP Changes
If doesn't matter why a character's CON changes (increase or decrease), the character's maximum HP is adjusted to match their new CON bonus. This is explicitly in the basic rules for Constitution.
If a character’s Constitution score changes enough to alter his or her Constitution modifier, the character’s hit points also increase or decrease accordingly.
This rule is why Rage increases a Barbarian's current and maximum hit points. It is why Damage or Drain to Constitution can reduce a character's current and maximum HP. This is why magical items that increase CON are desired by every character of every class.
The Damage a character has taken remains constant when HP changes due to CON changes. This is why Barbarians sometimes fall over dead when Rage ends - reverting to their normal Constitution reduces their current and maximum HP, but the HP damage remains; thus a Barbarian with 30 HP can suddenly drop to -50 HP and be very, very dead.
This feature is also why CON damage and drain are so dangerous. Characters have just as much HP damage but have fewer HP to absorb that damage.