It was narrated that Jarir said:"Any slave who runs away from his masters and joins the enemy, he has made it permissible to shed his blood."
أَخْبَرَنَا عَلِيُّ بْنُ حُجْرٍ، قَالَ حَدَّثَنَا شَرِيكٌ، عَنْ أَبِي إِسْحَاقَ، عَنْ عَامِرٍ، عَنْ جَرِيرٍ، قَالَ أَيُّمَا عَبْدٍ أَبَقَ مِنْ مَوَالِيهِ وَلَحِقَ بِالْعَدُوِّ فَقَدْ أَحَلَّ بِنَفْسِهِ .
Nesai
The Book of Fighting [The Prohibition of Bloodshed] • Hadith 4056