Whenever the Prophet ﷺ needed to relieve himself, he would go far away until no one could see him.
حدثنا مسدد بن مسرهد حدثنا عيسى بن يونس أخبرنا إسمعيل بن عبد الملك عن أبي الزبير
أن النبي ﷺ كان إذا أراد البراز انطلق حتى لا يراه أحد
Its isnad is daif. Ibn Majah narrated it in the Book of Purification, Chapter on keeping distance for relieving oneself in open ground, hadith 335, through Ismail bin Abdul-Malik, and he is daif. Ahmad and others graded him daif. Part of the hadith has many corroborating witnesses, including the preceding hadith.