Srimad Bhagavatam Canto 04, Chapter 13, Text 31

SB 4.13.31

sadasas-pataya ucuh
nara-deveha bhavato
nagham tavan manak sthitam
asty ekam praktanam agham
yad ihedrk tvam aprajah
 
Translation by His Divine Grace A. C. Bhaktivedanta Swami Srila Prabhupada: 
 
The head priests said: O King, in this life we do not find any sinful activity, even within your mind, so you are not in the least offensive. But we can see that in your previous life you performed sinful activities due to which, in spite of your having all qualifications, you have no son.
 
Purport by His Divine Grace A. C. Bhaktivedanta Swami Srila Prabhupada: 
 
The purpose of marrying is to beget a son, because a son is necessary to deliver his father and forefathers from any hellish conditional life in which they may be. Canakya Pandita therefore says, putra-hinam grham sunyam: without a son, married life is simply abominable. King Anga was a very pious king in this life, but because of his previous sinful activity he could not get a son. It is concluded, therefore, that if a person does not get a son it is due to his past sinful life.
Srimad Bhagavatam Canto 04, Chapter 13, Text 30
Srimad Bhagavatam Canto 04, Chapter 13, Text 32