What happens if your teleporter gets damaged when your entire remaining crew are currently boarding?
Solution 1:
When the battle is over, there will be a popup saying that your crew used one of the other ship's shuttles to return to yours. This will get all your crew back to your ship.
This can happen at any point after the battle, such as if the teleporter is destroyed by fire after the battle is over or if the last crew member on your ship suffocates.