Scripture is explicit that God chastens his sons and daughters, not as an act of juridical punishment, but one that is to help purge impurities and sinful propensities therefrom. For example:
Thou shalt also consider in thine heart, that, as a man chasteneth his son, so the Lord thy God chasteneth thee. (Deut 8:5)
I will be his father, and he shall be my son. If he commit iniquity, I will chasten him with the rod of men, and with the stripes of the children of men. But my mercy shall not depart away from him, as I took it from Saul, whom I put away before thee. (2 Sam 7:14-15)
Behold, happy is the man whom correceth: therefore despise not thou the chastening of the Almighty. (Job 5:17)
Blessed is the man whom they chastenest, O Lord, and teachest him out of thy law. (Psa 94:12)
The Lord hath chastened me sore: but he hath not given me over unto death. (Psa 118:18)
My son, despise not the chastening of the Lord; neither be weary of his correction. (Prov 3:11; cf. 13:24; 19:18)
Lord, in trouble have they visited thee, and they poured out a prayer when thy chastening was upon them. (Isa 26:16)
But when we are judged, we are chastened of the Lord, that we should not be condemned with the world. (1 Cor 11:32)
And ye have forgotten the exhortation which speaketh unto you as unto children, My son, despise not thou the chastening of the Lord, nor faint when thou art rebuked of him: For whom the Lord loveth he chasteneth, and scourgeth every son whom he receiveth. If ye endure chastening, God dealth with you as with sons; for what son is he whom the father chasteneth not? For if ye be without chastisement, whereof all are partakers, then are ye bastards, and not sons. Furthermore we have had fathers our flesh which corrected us, and we gave them reverence: shall we not much rather be in subjection unto the Father of spirits, and live? For they verily for a few days chastened us after their own pleasure; but he for our profit, that we migth be partakers of his holiness. Now no chastening for the present seemth to be joyous, but grievous: nevertheless afterward it yieldeth the peaceable fruit of righteousness unto them whichh are exercised thereby. (Heb 12:5-11)
And many as I love, rebuke and chasten: be zealous therefore, and repent. (Rev 3:19)
Nevertheless the Lord seeth fit to chasten his people; yea, he trieth their patience and their faith. (Mosiah 23:21)
And thus we see that except the Lord doth chasten his people with many afflictions, yea, except he doth visit them with death and with terror, and with famine and all manner of pestilence, they will not remember him. (Helaman 12:3)
Yea, wo unto this people who are called the people of Nephi except they shall repent, when they shall see all these signs and wonders which shall be showed unto them; for behold, they have been a chosen people of the Lord; yea, the people of Nephi hath he loved, and also hath he chastened them; yea, in the days of their iniquities hath he chastened them because he loveth them. (Helaman 15:3)
And inasmuch as they sinned they might be chastened, that they might repent. (D&C 1:27)
Let that which has been bestowed upon Ziba Peterson be taken from him; and let him stand as a member in the church, and labor with his own hands, with the brethren, until he is sufficiently chastened for all his sins; for he confesseth them not, and he thinketh to hide them. (D&C 58:60)
Nevertheless, I would suffer that ye should part until you were chastened for all your sins, that you might be one, that you might not perish in wickedness. (D&C 61:8)
My disciples, in days of old, south occasion against one another and forgave not one another in their hearts; and for this evil they were afflicted and sorely chastened. (D&C 64:8)
And I give him a new commission and a new commandment, in the which I, the Lord, chasten him for the murmurings of his heart; and he sinned; nevertheless, I forgive him and say unto him again, Go ye into the south countries. (D&C 75:7-8)
But verily I say unto you, that I, the Lord, will contend with Zion, ad plead with her strong ones, and chasten her until she overcomes and is clean before me. (D&C 90:36)
Verily, thus saith the Lord unto you whom I love, and whom I love I also chasten that their sins may be forgiven, for with the chastisement I prepare a way for their deliverance in all things out of temptation, and I have loved you--wherefore, ye must needs be chastened and stand rebuked before my face. 3 For ye have sinned against me a very grievous sin, in that ye have not considered the great commandment in all things, that I have given unto you concerning the building of mine house; For the preparation wherewith I design to prepare mine apostles to prune my vineyard for the last time, that I may bring to pass my strange act, that I may pour out my Spirit upon all flesh--But behold, verily I say unto you, that there are many who have been ordained among you, whom I have called but few of them are chosen. They who are not chosen have sinned a very grievous sin, in that they are walking in darkness at noon-day. And for this cause I gave unto you a commandment that you should call your solemn assembly, that your fastings and your mourning might come up into the ears of the Lord of Sabaoth, which is by interpretation, the creator of the first day, the beginning and the end. Yea, verily I say unto you, I gave unto you a commandment that you should build a house, in the which house I design to endow those whom I have chosen with power from on high; For this is the promise of the Father unto you; therefore I command you to tarry, even as mine apostles at Jerusalem. Nevertheless, my servants sinned a very grievous sin; and contentions arose in the school of the prophets; which was very grievous unto me, saith your Lord; therefore I sent them forth to be chastened. (D&C 95:1-10)
And to the residue of the school, I, the Lord, am willing to show mercy; nevertheless, there are those that must needs be chastened, and their works shall be made known. (D&C 97:6)
Verily I say unto you, that I, the Lord, will chasten them and will do whatsoever I list, if they do not repent and observe all things whatsoever I have said unto them. (D&C 98:21)
And now I give unto you a word concerning Zion. Zion shall be redeemed, although she is chastened for a little season. (D&C 100:13)
Therefore, they must needs be chastened and tried, even as Abraham, who was commanded to offer up his only son. For all those who will not endure chastening, but deny me, cannot be sanctified . . . Behold, there is wisdom concerning the children of Zion, even many, but not all; they were found transgressors, therefore they must needs be chastened. (D&C 101:4-5, 41)
And that those who call themselves after my name might be chastened for a little season with a sore and grievous chastisement, because they did not hearken altogether unto the precepts and commandments which I gave unto them. (D&C 103:4)
And people must needs be chastened until they learn obedience, if it must needs be, by the things which they suffer. (D&C 105:6)
On 1 Cor 3:10-16 and D&C 76:104-107, see:
Discussing the issue of parents chastising and disciplining their kids and the importance telos thereof, Jordan Peterson wrote the following, which can be easily transposed to the spiritual realm, too, and God’s chastising and punishing his wayward sons/daughters to make them fit citizens in the Kingdom of God (of course, God is perfect in his chastisements, unlike mortal parents):
First, why should a child be subject? That’s easy. Every child must listen and obey adults because he or she is dependent on the care that one or more imperfect grown-ups is willing to bestow Given this, it is better for the child to act in a manner that invites genuine affection and goodwill. Something even better might be imagined. The child could act in a manner that simultaneously ensures optimal adult attention, in a manner that benefits his or her present state of being and future development. That’s a very high standard, but it’s in the best interests of the child, so there is every reason to aspire to it.
Every child should also be taught to comply gracefully with the expectations of civil society. This does not mean crushed into mindless ideological conformity. It means instead that parents must reward those attitudes and actions that will bring their child success in the world outside the family, and use threat and punishment when necessary to eliminate behaviours that will lead to misery and failure.
There’s a tight window of opportunity for this, as well, so getting it right quickly matters. If a child has not been taught to behave properly by the age of four, it will forever be difficult for him or her to make friends. The research literature is quite clear on this. This matters, because peers are the primary source of socialization after the age of four. Rejected children cease to develop, because they are alienated from their peers. They fall further and further behind, as the other children continue to progress. Thus, the friendless child too often becomes the lonely, antisocial or depressed teenager and adult. This is not good. Much more of our sanity than we commonly realize is a consequence of our fortunate immersion in a social community. We must be continually reminded to think and act properly when we drift, people that care for and love us nudge us in small ways and large back on track. So, we better have some of those people around. (Jordan B. Peterson, 12 Rules for Life: An Antidote to Chaos [Toronto: Random House Canada, 2018], 134-35)