No person will be punished for the sins of another. Each person will be brought to account for his own sins. Allah says (interpretation of the meaning):
“And no bearer of burdens shall bear another’s burden”[Faatir 35:18]
But if the father or mother commits a sin, this may be a cause of making the family members follow their example.
Majmoo’ Fataawa al-Shaykh Ibn Baaz, 2/610
But the consequences of the sins committed by the sinner may go beyond him to affect his family, as a punishment for him and a test for his family. Allah tests man with disasters in order to expiate for his sins, and Allah may test people with blessings. Allah says (interpretation of the meaning):
“We shall make a trial of you with evil and with good” [al-Anbiya’ 21:35]
Whatever the case, the Muslim must avoid sin so that he will not be subject to the wrath and anger of Allah. And Allah knows best.