You may pray to the various gods of Crawl by pressing p. Prayer's effect depends entirely on the particular god you worship.
Praying at an altar whose god you are not currently worshiping will give you an offer to enter that god's service (if eligible). Be aware that if you already worship another god, switching religions may result in penance (see individual gods for details). Merely praying at another god's altar and declining to convert will have no effect, however.
Worshippers of Fedhas can pray to decompose all corpses in line of sight, gaining some piety and creating several toadstools in the process.
Followers of Jiyva with at least *** piety can pray to paralyze jellies on the level at the cost of some piety and MP. This temporarily stops them from devouring items, giving the player a chance to pick up treasure before the jellies get to it.
The prayer command was removed in version 0.19. Using a god's altar is now done by pressing < or >.
In various older versions, many of the gods gave the player piety for sacrificing corpses or other specific items, which was done by praying while standing on top of them.