Of course the altar has to be one of your god. If you offer something to other gods, your own god will get angry and punish you. When you offer corpses your god will bless you, or even give you some artifact. Then you can drop a potion of water on it and pray. Depending on the altar you will either get holy or unholy water.
Holy water is very usefull.
You can drink it to cure lycanthropie or other harmfull things. You can dip things in it to bless them or remove a curse. Yes very usefull indeed. If you get stuck with a cursed totaly corroded chain mail shirt. Or dip a scroll of identify in it to identify more items.