Religion enters into the book in the character of Soaphead Church. He is a fake who people seek out to have their wishes fulfilled. These people have lost faith in traditional forms of religion and are now just looking for miracles as a way out of their misery. Therefore when Pecola is pregnant she goes to him and asks not for something like the usual - more money or so forth but she asks for beauty. Soaphead Church is touched and for the first time wishes he could do miracles.
Pecola's request forces Soaphead Church to acknowledge that he is a fake and this angers him not only with himself but with God too. Therefore he writes a letter to God. Soaphead's view of the world was that God should have already blessed Pecola with the blue eyes she wishes and therefore out of anger, he takes it upon himself to do for Pecola what God refuses to. He makes her happy by giving her blue eyes. Of course this is only an illusion.
The enotes analysis sums this up well, "Morrison uses Soaphead Church to illustrate the problems of faith and Pecola’s reliance upon faith. By praying and going to this fake in hope of blue eyes, Pecola has resisted self-reliance and withdraws more deeply into the idea of being beautiful."
For more details check out the analysis in Enotes.