The Messenger of Allah ﷺ said, "Whoever you find committing an act with an animal, kill him and kill the animal."Ibn Abbas was asked, "What is the reason for killing the animal?"He replied, "I did not hear anything from the Messenger of Allah ﷺ about that, but I think the Messenger of Allah disliked that its meat be eaten or that it be put to any use after such an act had been done with it."
حدثنا محمد بن عمرو السواق حدثنا عبد العزيز بن محمد عن عمرو بن أبي عمرو عن عكرمة
قال رسول الله ﷺ من وجدتموه وقع على بهيمة فاقتلوه واقتلوا البهيمة فقيل لابن عباس ما شأن البهيمة قال ما سمعت من رسول الله ﷺ في ذلك شيئا ولكن أرى رسول الله كره أن يؤكل من لحمها أو ينتفع بها وقد عمل بها ذلك العمل
Its isnad is hasan. Abu Dawud also reported it in the Book of Hudud, chapter on the one liable for a hadd punishment coming forward to confess, hadith 4379, from Muhammad bin Yahya Dhuhli through this same chain, and Ibn Jarud graded it sahih, hadith 823 (the man had not yet been stoned).