This is the sort of question that has been debated for decades! You've filed your question under "military history," but the question itself could be broken down into two elements which are, while connected, different.
Why is something like Remarque's All Quiet on the Western Front (fiction) considered to be a work of literature, while something like Bernard Cornwell's wildly popular series of historical novels about the Napoleonic wars, as seen through the eyes of rifleman Richard Sharpe (also fiction), might not be?
At what point does a work of military history (non-fiction), particularly a narrative one which incorporates the perspectives of multiple people, become literature, rather than simply an engaging history?
Let's look at the definition of literature to help us out here: literature is "written works, especially those considered of superior or lasting artistic merit." So, there's a value judgement inherent in this definition. We're not just thinking of literature as what it really means, i.e. "something written down."
The answer to sub-question one then is extremely subjective, and comes down to essentially snobbery. Many works which are now considered literary were dismissed in their time as being immoral fluff: most notably, the concept of the novel itself was originally thought of as something purely for women, and of no real value to society. Samuel Taylor Coleridge, for example, was hugely critical of early Gothic novels, such as Ann Radcliffe's works, which are now thought of as literary classics. Melville's Moby Dick was panned by contemporary critics who thought it a disaster, but it's now considered a cornerstone of American literature. So, this subquestion utilizes "literary" as a term bestowing value or importance on the work. Something might be considered more literary if it is less popular, less widely read, and perceived as more "difficult." But what falls into this category of literature, in this sense, can change over time.
Let's look at question two with this in mind. What literature does not mean is "something fictional." That's nowhere in the definition. However, people often make a connection between literature and, if not outright fiction, the idea of being able to hear people's viewpoints on things, get inside their heads, as it were, even if that means some poetic licence on the writer's part. Shakespeare's history plays, for example, aren't always entirely historically accurate, but they do what we want "literature" to do. They show us insight into the characters, make us feel engaged in the story, and they tell us the broad strokes of what happened in some (often very confusing) wars that make up part of our history. Are they great accounts of history? Maybe not. Are they literature? Definitely. Can something be totally historically accurate and literary? Well . . . why not?
In modern usage, a line is often drawn between "literary" and "non-literary" texts, even though the idea of a "non-literary text" is really an oxymoron. But the main distinction is the purpose of the works. If something is written purely for informational or transactional purposes, like a contract, timeline, basic record of war, etc, it would be called non-literary. A literary text about war would have a narrative, and be written to entertain and engage as well as just convey information. So a totally historical accurate text which tells a good story, engages the reader, and contributes something valuable to humanity, is literature.
But as to why some totally historically accurate texts which tell good stories in engaging ways are considered trash (like Barry Davies' Heroes of the SAS books) and some are considered literature? That can be arbitrary, and (see point one) comes down to snobbery.