In the Christian perspective, praying for sons would be the main way of securing offspring; but it seems that in Hinduism ritual is stronger than prayer and stronger than spontaneous requests made to the gods. The standard expression for all religious actions of human beings is puja ('worship') which is physical, verbal and mental. True prayer, no doubt, also existed and exists, but we have little information.
Pilgrimages for obtaining sons are apparently not uncommon (SYED To 147). But there were few Hindu temples, structural or rock-cut, before the middle of the first millennium A.D. Moreover, fertility cults have not produced remarkable temples in any period.