Until about 25 years ago, scientists assumed that religious behaviour was simply the product of a person's socialisation - or "nurture". But more recent studies, including those on adult twins who were raised apart, suggest genes contribute about 40% of the variability in a person's religiousness.
That actually makes sense. Religion correlates with many beneficial social traits, and although it's unlikely that religion itself is genetic, it's intuitive that many of the traits associated with "religion" have genetic components.
About a dozen studies have shown that religious people tend to share other personality traits, although it is not clear whether these arise from genetic or environmental factors. These include the ability to get along well with others and being conscientious, working hard, being punctual, and controlling one's impulses.
It's likely that these traits predispose a person towards accepting and thriving in a "religious" environment, and that religion is an effect rather than a cause. An interesting situation, considering that genetic predisposition is no excuse for sin -- or for disbelief.
Clayton Cramer discusses genetics in the context of predestination.