Many scientists and fiction writers see no contradiction in reconciling the principles of their endeavor with the principles of their chosen religion, so it's no surprise that science fiction and fantasy authors share their ideas about religion through their work. These range from proponents of magic and witchcraft, to adherents of Christian doctrines, to monotheism-rejecting classics such as Robert A. Heinlein, whose Stranger in a Strange Land inspired many a new age-aspiring free spirit.
On the other hand, many science fiction authors make their characters voice arguments against religion. Two important figures among them are the Canadian Robert J. Sawyer and the American Carl Sagan, both writing in the hard science fiction subgenre.
In his Neanderthal Parallax, Sawyer envisions a parallel universe where Neanderthals were not wiped by our ancestors, but prospered to build a civilization based on freedom of thought, constraints of applied genetics, tolerant bisexuality, total surveillance, and lack of any notion of afterlife. In Hominids, the reader can follow a conversation between two scientists, the Catholic Mary (our kind of human) and the atheist Ponter (Neanderthal):
"But, look," said Mary, "you still haven't answered my question about morality. Without a God—without a belief that you will be rewarded or punished after the end of your life—what drives morality among your people? I've spent a fair bit of time with you now, Ponter; I know you're a good person. Where does that goodness come from?"In Contact, Sagan provides numerous theological discussions, from pointing out inconsistencies in the two versions of Jesus' family three in the New Testament, to the issue of inclusiveness in regard to the profile of delegates who should represent the—mostly religious—human race before other sentient civilizations. Some of it spilled over in the Jodie Foster movie that followed.
"I behave as I do because it is right for me to do so."
"By whose standards?"
"By the standards of my people."
"But where do those standards come from?"
"From..." And here Ponter's eyes went wide, great orbs beneath an undulating shelf of bone, as though he'd had an epiphany—in the secular sense of the word, of course. "From our conviction that there is no life after death!" he said triumphantly. "That is why your belief troubles me; I can see it now. Our assertion is straightforward, and congruent with all observed fact: a person's life is completely finished at death; there is no possibility of reconciling with them, or making amends after they are gone, and no possibility that, because they lived a moral life, they are now in paradise, with the cares of this existence forgotten." He paused, and his eyes flicked left and right across Mary's face, apparently looking for signs she understood what he was getting at.
"Do you not see?" Ponter went on. "If I wrong someone—if I say something mean to them, or, I do not know, perhaps take something that belongs to them—under your world view I can console myself with the knowledge that, after they are dead, they can still be contacted; amends can be made. But in my world view, once a person is gone—which could happen for any of us at any moment, through accident or heart attack or so on—then you who did the wrong must live knowing that that person's entire existence ended without you ever having made peace with him or her."
Mary thought about that. Yes, most slave owners had ignored the issue, but surely some people of conscience, caught up in a society driven by bought-and-sold human beings, must have had qualms... and yet had they consoled themselves with the knowledge that the people they were mistreating would be rewarded for their suffering after death?