The I/O pins have diodes on them going down to Vcc.
If you connect voltage higher than (Vcc+0.7) to a pin, the excess voltage goes through the diode into Vcc. This protects the pin from overvoltages (up to a point, if there's a lot of amps the diode won't cope).
If the chip is unpowered you can send voltage into Vcc through these diodes (it's no different than putting a diode into the +5V hole on the edge connector then connecting power to it).
Will it damage the chip? That depends on how much current the chip tries to use and what's attached to it. The diodes are pretty small...