What is happening here is that the prisoner is trying to escape from you. They think you are trying to attack them. Unless you free the prisoner first, they will always flee from you.
I'm not sure this is true. Playing on the Stormcloak side with a previous character I used to attack the soldiers first and then just let the prisoner go. Then I walked into town one day and found I had an unexpected bounty on my head. I couldn't figure out why, since I played a law-abiding character and hadn't done anything illegal that I knew of... and I didn't consider attacking legionnaires to be "illegal" given that the game should have considered them an enemy faction.
So then I experimented with freeing the prisoner first and as someone already noted this usually ended up with the prisoner dead. Maybe because once his hands are unbound he starts fighting the soldiers and no matter what weapons I would "share" with him, he always fought barehanded.
So this time around I have just been attacking the soldiers again first, undetected in sneak mode when possible for at least the first one. Or if I happen upon them too quickly for that I sometimes just stand in their way until they go aggro anyway. So far not one single prisoner has died, and no bounties. In every case the prisoner has run a short distance away and then stopped, allowing me to go free him and share items.
I suspect the bounties in the first playthrough might have come from killing Imperial soldiers in Imperial-held holds before the war was finished, but I'm not sure.
The coolest one so far was just last night, I was coming back to Whiterun from up north and on the ridge between the city and the road to the east of it were two soldiers and one prisoner just standing there. All had their backs turned and I got both soldiers with my bow before they even knew I was there. The prisoner stayed put and when I got to him and went to share items he already had an Imperial bow in his inventory, I can only assume he was looting it off one of the dead soldiers.