The Greek word Paul uses to describe this couple is sunaichmalotoi, his fellow prisoners
(KJV, ESV). The NIV is a bit more explicit, reading that they have been in prison with me.
We do not have any further information about this imprisonment, and the particular choice of the phrase here is striking, given that Paul was not imprisoned at the time when he wrote this letter. The NIV seems to suggest that the Greek word here refers back to something that had occurred in the past, but Paul here actually characterizes these two people as his fellow prisoners in very general terms. Even more importantly, the Greek word here does not simply refer to a fellow prisoner, but rather to a fellow prisoner of war.
Prisoners of war are not people who are in prison per se, but rather people who have lost their freedom and are now in the service of the lord who had conquered them. The text could therefore just as easily be translated as they are my fellow citizens and the Lord took possession also of their lives (for service in the gospel).
1
7 Greet Andronicus and Junia, my kinsmen and my fellow prisoners. They are well known to the apostles, and they were in Christ before me.