What is the author's purpose in writing All Quiet on the Western Front?
This novel recalls Stephen Crane's poem "War is Kind" and Ernest Hemingway's short story "Soldier's Home." In Crane's poem, as in Part I of All Quiet on the Western Front, the glories of war are exalted and the war propaganda abounds, but is satirized by both. Then, as in Hemingway's "Soldier's Home" in which the son returns home, Paul in Part II returns for a visit to his home and realizes that he is not the same person and he cannot relate. In Part IV, once the war is over, Paul reflects upon what it means to go home after seeing friends shot and killed:
Now is we go back we will be weary, broken, burnt out, rootless, without hope. We will not be able to find our way any more.
And men will not understand us....We will be superfluous even to ourselves, we will grow older, a few will adapt themselves, some others will merely submit, and most will be bewildered--the years will pass by, and we shall fall into ruin....
I am very quiet. Let the months and years come, they can take nothing from me, nothing more. I am so alone, so without hope that I can confront them without fear.
Erich Maria Remarque's novel is the desperate recordings of a human soul that has gone much farther into the depths of desperation that anyone should. Because of this, Remarque records the terrors and aloneness of the World War I soldier so that people will understand the horrors of war for a generation lost because of this experience.
To add to the great answers above, there is another poem that refers to Remarque's message in All Quiet on the Western Front. The poem "Dulce et Decorum Est" by Wilfred Owen challenges popular war-time propaganda and questions whether or not it is an honor to die for one's country. In the poem, Owen vividly describes the horrors that the soldiers experience in war before ending the poem with the rhetorical question of whether this is all worth it. In All Quiet on the Western Front, the young soldiers are convinced by their elders that they should fight for their fatherland Germany because it is the honorable thing to do. When Paul returns home on leave, he is angry with the elder men because they do not understand the reality of the battlefront--they only understand the romanticized glory of battle. Paul recalls all his friends who have died so far and the other tragedies that have occurred on the battlefield, and he questions the cause for their fighting. Earlier in the novel, the men talk about the "higher-ups" who just make decisions but do not have to fight, and they are angry about this reality. So the novel, like Owen's poem, challenges the idea of there being honor in fighting for one's country.
Particularly if you look at the rather intense reactions to the book in Europe and in other places, claiming that it was a book designed to destroy "manliness" and make nations and people weak, you could suppose that part of the author's purpose was to demonstrate to people the horrors of war.
Like much of the literature and other art to come out after WWI, it was hopeless in a way, showing the futility and horrible nature of trench warfare and the disgusting efficiency with which men and machines could now kill each other. In this way you could also describe it as an anti-war novel.
It was also similar to a bildungsroman, a coming of age story about the boys and their transition from students to soldiers to veterans and then, for almost all of them, to dead soldiers.