This mantra is found in the Taittirīya Āranyaka, IV-42, and is one of the most significant chants in the collection of ten śānti-pāṭaḥ known as the Daśaśāntayaḥ. Śānti-pāṭaḥ are chants recited at the beginning of certain sections of the Veda-s to promote peace and attention in the teaching-learning process.
Sarva śāntiḥ asks for a state of no disturbance in the environment: earth, space, heaven, the five elements, two-legged and four-legged beings, flora and fauna of the earth, to puruṣa within, brahma (the highest force), and all those who invoke the help of this highest force.
Once we have asked for peace in the first paragraph, how do we use it?
Birds, animals, lesser beings were created so that humankind will look after them – we can use a state of no disturbance to help others, to spread śāntih to everyone. When we are in a state of no disturbance (in our body, breath and mind) – we give this to others so that only then the whole environment is at peace. You could call it the ‘environmental peace mantra’.