I did some testing with the developer tools and here is what I found.
To capture an enemy, you first need to have a downed enemy in the map (duh!). You then need to build a prisoner bed on the same map as that enemy. You will be able to capture him and put him in the bed or a sleeping area marked for prisoners.
At this point, you can wait for your people to give him some basic heal. Once you did that or decided that his life is not worth that much to you (which you should consider since he wanted to kill your friends), you can right click on him and you will have an option to carry him outside the area. This will create a new caravan with the prisoner and his personal transport (aka your friend). You can make him move anywhere you want just like a regular caravan.
Once you bring the caravan to your colony, you have to be careful to capture the enemy once again (this is your second shot at thinking about the value of his life). It seems there might be a bug that drops him on the ground when the caravan enters an area. You should be able to capture him once again.
I noticed a few bugs while doing this.
- Sometimes, you cannot re-use the prisoner bed after carrying someone outside of the area. This is fixed by marking and unmarking the prisoner bed.
- Sometimes and after some time with the prisoner in the bed, you will not be able to carry him outside the area. I did not find a workaround other than not waiting after healing him, or simply not healing him.
It does not seems this is currently an expected behaviour in the game but it would be nice to have those few issues fixed or have some new system that do not force you to put them in a bed immediately. Healing the prisoner is still a good idea so I don't mind placing a bed.
Also, I did not test while attacking an enemy base, only during ambushes, but I think that you can do the same thing.
I did some more testing and the same thing happens when you are attacking. It also seems that when you form your caravan, prisoners will follow you if you select them in the caravan screen.