Various research projects have produced conflicting answers to this question. Some found that when faced with the possibility of death, an avowed atheist is likely to reneg on that position and perhaps call out for help to a God he never believed in before. But other studies have found the opposite—that in a brush with death, both religious believers and nonbelievers were each inclined to reinforce their own belief stance.
One possible reason for this inconclusive evidence is the failure of these projects to distinguish between two types of atheist. Not all nonbelievers are of the same ilk. Some non-believers are pre-religious, and some are post-religious.
The type of person I am calling “pre-religious” is one who has never bought into religious belief, and/OR has never absorbed the good values that religious belief can bring. (granted that these values can be obtained through channels other than religion.) But such folks have a more superficial form of non-belief. They have not carefully thought through their beliefs and have not considered various options. Their nonbelief is not rooted in rational analysis. For this person, about whom I have written elsewhere under the term Lawless (http://www.exploring-spiritual-development.com/The-Lawless.html) their whole world is about themselves. Their worldview is egocentric. If they die, their world ends. So in the face of an impending death, why not embrace something larger than oneself in the form of religious belief? I am quite certain that a study including only this level of person would show that they do tend to turn toward religious belief in the face of death.
But, there is another type of nonbeliever that I am calling post-religious. This person once believed in some particular religion (or was raised with the good values that religion can bring, and/or was taught or encouraged to analyze religious belief critically.) This form of nonbelief is more firm, more reasoned, and in fact, MORE MATURE than the pre-religious type. Based on sound values and critical analysis, this person’s worldview tends to extend beyond him or herself. What I call the Rational level person (http://www.exploring-spiritual-development.com/The-Rational.html) tends to hold a worldcentric worldview.
For the post-religious person death is not as final, or as devastating as it would be for the pre-religious person: “The world will continue even when I am gone.” As someone who has studied these stages carefully, I am quite certain research would show that such people are more likely to accept the finality of their own demise. They may even find satisfaction in having contributed something of enduring value to the society that will continue beyond their own life. This could be in the form of the children they have raised, or some cause to which they have devoted their energies.
When it comes to considering whether atheists remain atheists when placed in a foxhole, what would really help clarify any such future research is a distinction between the response of pre-religious nonbelievers and post-religious nonbelievers.