The claim “there are no atheists in foxholes” is and always has been a lie.
The First World War gave rise to French Existentialism and caused people to turn away from religion in record numbers. In fact, according to all the available data, war causes people, not only to leave religion, but to become sceptical.
My great-great-grandmother turned her back on religion because her baby died and the priest told her that, because the child hadn’t been baptised, its soul would be burnt and tormented for all eternity. She said, and I quote, “If your god is such a bastard that he’d torment something as sweet and innocent as a child for all eternity, then he’s no god of mine!”
That was in 1878.
That kind of sentiment would become very prevalent during and after the “Great War”. Why would god allow injustice? Why would god allow the killing of innocents? And so on.