According to evolutionary theory, genes that produce brains that in turn produce consciousness have evolved because consciousness serves critical life functions. For example, consciousness allows for awareness of resources necessary for survival as well as of the presence of predators or dangerous situations. Conceivably, then, protohumans having consciousness-producing brains and who took appropriate actions have survived long enough to pass on the genes for these brains to their offspring. In evolutionary terms, "consciousness genes" are adaptive, and adaptive traits are genetically transmittable across generations. The same could conceivably be true for a trait like spirituality.
Evolutionists also have a second evolutionary explanation for the origins of spirituality, one resting on species comparisons. Comparing humans with other species (primates in particular) reveals many similarities ranging from genes and anatomy to quite a few behaviors as well as to some basic psychological functions. Charles Darwin's report on his dog (he called it "a very sensible animal") is a classic example. On a slightly breezy day, his dog growled and barked when an open parasol beside him moved. In interpreting the dog's reaction, Darwin noted that he "reasoned to himself in a rapid and unconscious manner, that movement without any apparent causes indicated the presence of some strange living agent, and that no stranger had a right to be on his territory." Such an explanation may seem a bit stretched, but it is not implausible. Darwin was an excellent observer and very cautious about making unwarranted speculations. He also had a big theory to back him up.
As of today, we know nothing about spiritual evolution in nonhuman species. A baboon staring quietly at a sunset may be engaging in baboon spirituality. Or it may not. Most likely, we will never know. Humans staring at a sunset can tell us what they are experiencing, and we can judge from there whether their experience qualifies as spiritual or not.
There have been no controlled studies of what specific cultural factors have a causal effect on spiritual development in children. Of course, in most cultures children are taught to pray and think about God or spirits, but the causal connection between what they are taught and their spiritual development is far from understood. A cursory search of the research literature on religious beliefs reveals that there are some connections between such variables as parental values, social class, intelligence, and educational level on the one hand, and their children's religiosity and level of moral development on the other. However, all of this research is correlational in nature, which means that we cannot ascribe with any certainty causal connections between these factors and religiosity.
Additionally, there appear to be no systematic scientific studies of spirituality per se in early childhood. Anecdotal accounts of spirituality in children exist, but they are not sufficiently rigorous or systematic enough to give them status above what parents, clergy, teachers, and interested lay persons can already tell us.
No matter how seriously we emphasize genes, evolution, and basic human brain functioning (all factors that precede in time the creation of the individual), and no matter how we emphasize the powerful roles of culture and environment (factors outside the individual), a person's life comes about through the dynamic interaction of all these factors.