Sunan an-Nasa'i, Book 37, Hadith 91 (In-Book)

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."

أَخْبَرَنَا عَلِيُّ بْنُ حُجْرٍ، قَالَ حَدَّثَنَا شَرِيكٌ، عَنْ أَبِي إِسْحَاقَ، عَنْ عَامِرٍ، عَنْ جَرِيرٍ، قَالَ أَيُّمَا عَبْدٍ أَبَقَ مِنْ مَوَالِيهِ وَلَحِقَ بِالْعَدُوِّ فَقَدْ أَحَلَّ بِنَفْسِهِ ‏.‏

sunnah.com