While prayer is used by those of religious faith, it is also used as a means of communication between humans and God, as well as the angels. Long before they knew of the existence of angel, Sam
Dean prays for Castiel's help when he is trying to stop Sam from meeting with Lilith.
Looking to give himself to Michael as a vessel, Dean finds a preacher on the street and asks him to pray to the angels and to them them here is there. Castiel hears this prayer and arrives, beating Dean in anger before taking him back to Bobby's.