I actually thought a lot of people knew this or have done it at some point in their Civ player days. When you have a large army that is stuck in enemy territory and you need them back within your borders (because your base is about to fall apart, your units are too injured and can't get out, etc) take over the easiest city close to you, fortify your injured units in the newly captured city, then give the city to a civ (preferably one that isn't strong). This will automatically warp all of your men back to your Capital. It is way better than having to lose them all on the way back.