From the Fextralife Wiki:
There are multiple ways to escape Fort Joy. The straight forward way is to open the gate guarded by 4 magisters and kill them, then you can fight your way out.
You can also use the Teleporation Glove acquired from quest The Teleporter to teleport one of your party member to the second level of Fort Joy (South to the gate guarded by 4 magisters). Put the ladder down and sneak into the playground. There you can find an enemy called Kniles the Flenser. Kill him and use the key on his body to open the gate to sewer. You can escaped Fort Joy through this sewer.
During quest Withermoore's Soul Jar, lord Withermoore will tell you there is a secret switch under the statue of the Seven in courtyard.
In quest The Imprisoned Elf, an elf Amyro promised to show you a way out after you retrive the stolen supplies.
Cas