You don't lose any turns if you have a photon on your ship and you're attacked by another player. The only way your photon detonates and you lose turns is if you enter a sector and:
1) Are hit by navhaz.
2) Are hit by offensive fighters, sector or planetary.
3) Are hit by armid mines.
4) Are hit by a planet's Quasar Cannon.
or
5)You attack and blow up a starport or planet and get hit by navhaz when re-entering the sector.
You do NOT lose turns if you have a photon on your ship and any of the following happen:
1) You're attacked by another player, alien, or Fed, even if you're podded.
2) You're attacked by the laser cannon while attacking a starport.
3) You blow up a starport, except as in #5 above.
4) You blow up a planet, except as in #5 above.
5) You blow up a ship and get hit by corbomite.
6) You attack another ship with photons on it.
7) You attack a Fed and get podded.

You try to lay fighters in Fedspace and have Captain Zyrain penalize you.
9) A limpet attaches to your ship.
10) You're hit by a photon (but you still lose your turns).
11) You run into defensive or toll fighters, whether you retreat or attack them.
If you're hit by a photon or your photon detonates:
1) In a turn-limit game, you lose all accumulated turns and have to wait until the top of the hour to do anything that requires turns (actually, if you have 0 turns, you can pick up a load of colonists at Terra even though it's supposed to take 1 turn to do so---I tried it, but it doesn't work on other planets). You can still do anything that doesn't require turns (land on a planet, lay fighters, attack somebody or something else, cloak, be towed, etc.).
2) In an unlimited turn game, you lose the ability to do anything that would ordinarilly require turns for 1 minute per second the photon duration is set to. For example, if the photon duration is set to 5 seconds, you'd be immobile for 5 minutes.
Thanks to Cabal (
http://www.tw-cabal.com/) for most of this information. I also tried many of these ways myself.