Ask either guard,
IF I ASKED THE OTHER GUARD WHAT HIS DOOR LEADS TO, WHAT WOULD HE SAY?
Then, if this guard says Freedom, take the door you are in front of. If he says Imprisonment, then take the other door.
Yeah I know it's complicated, but work it out yourself and see if I'm wrong. I asked...