In Rupert Brooke's "Peace," I believe the poet's use of literary techniques adds a different dimension to the literature beyond the words and images. Often the literary devices such as alliteration or onomatopoeia create a sound that supports a specific aspect of the poem's message. Generally literary devices are used to make a poem more impactful.
This poem is very dark—somber. The "peace" that the title refers to speaks of death. The first stanza (of eight lines) seems to thank God for delivering young men from a world filled with the disillusionment of war.
Glad from a world...old and cold and weary,
Leave the sick hearts...
...half-men...dirty songs and dreary,
And...emptiness of love!
My sense is that the author speaks from a very "gloomy" place. He is cynical, despairing in how he sees the world. He speaks of God catching "our youth...wakened...from sleeping..." as if the innocence of youth (when there is little to worry about) is taken as the young are thrust into war. (Brooke was a war poet, among other things.) His perception is that the loss of innocence comes in the face of war and that God has released the young from a world Brooke sees as one lacking hope; a place that is cold and unwelcoming; releasing those sick at heart who were unable to answer "honour's" call; leaving the permanently injured ("half-men") behind; as well as those who have experienced unfulfilled love.
Brooke paints an image of the dreams and innocence of youth being destroyed in the experience of battle, and then—in the midst of this sad and tragic enlightenment to the world of war—youth is released —with God's blessing, Brooke seems to say—in death. This is what is delivered to the reader in the second stanza.
"...the worst friend and enemy is Death" presents idea of what "saves" these men from shame, illness, grief, a broken body no longer breathing, and the agony that shakes "the laughing heart's long peace."
With all of this said, we return to your question: What purpose does alliteration serve in the poem? For me, it starts in the first line: it is the sound of one's dying breath. The words noted all have the same sound (which is necessary to create alliteration). The sound is the "breathy" "h" sound: Who...has..His. The beginning sound in each word promotes a sense of failing breath, of those for whom God has "matched us with His hour." I see this to mean that God had brought "us" to our last hour—to be "out of time"—now with God, who does not know the passing of time.
Our ears are caught again with "old" and "cold" in fifth line, as we are given the sense of how quickly the soldier grows tired with the images of war...
To turn... / Glad from a world grown old and cold and weary...
Alliteration is also here:
Naught broken save this body, lost but breath;
The alliteration occurs here with the repeated sound of "b" in "broken...body...breath." The "b" is a strong-sounding letter, much different than the "h" sound. Here the "b" may point out the physical assault of war that breaks the body and robs it of its life-breath. (It's almost sarcastic—"noting is broken but the body, and loss of breathing...)
The use of personification draws our attention to how war affects every aspect of a person's being: especially the heart:
Leave the sick hearts....Nothing to shake the laughing heart's long peace...
These elements affect our understanding of the harsh reality of war, especially as it destroys our youth.