Job revealed the state of his mind not only by deeds, but also by words. For he rationally demonstrated that although he suffered sadness, he did not have to yield to sadness. First, he demonstrated from the condition of nature so the text said, "He said: Naked I came forth from my mother's womb," namely, from the earth which is the common mother of everything, "and naked shall I return there," i.e., to the earth. Sirach speaks in the same vein saying, "Great hardship has been created for man, and a heavy yoke lies on the sons of Adam from the day they come forth from their mother's womb until... the day they return to their burial in the mother of them all." (40:1) This can also be interpreted in another way. The expression, "from my mother's womb" can be literally taken as the womb of the mother who bore him. When he says next "naked I shall return there," the term "there" establishes a simple relation. For a man cannot return a second time to the womb of his own mother, but he can return to the state which he had in the womb of his mother in a certain respect, namely in that he is removed from the company of men. In saying this he reasonably shows that a man should not be absorbed with sadness because of the loss of exterior goods, since exterior goods are not connatural to him, but come to him accidentally. This is evident since a man comes into this world without them and leaves this world without them. So when these accidental goods are taken away if the substantial ones remain man ought not to be overcome by sadness although sadness may touch him.
Second, he shows the same thing from divine action saying, "The Lord gave; the Lord has taken away." Here his true opinion about divine providence in relation to human affairs must first be considered. When he says, "The Lord gave," he confessed that earthly prosperity does not come to men accidentally either according to fate or the stars, or as a result of human exertion alone, but by divine direction. When he says, however, "The Lord has taken away," he confesses also that earthly adversities also arise among men by the judgment of divine providence. This leads to the conclusion that man does not have a just complaint with God if he should be despoiled of his temporal goods, because he who gave freely could bestow them either until the end of his life or temporarily. So when he takes temporal goods away from man before the end of life, man cannot complain.
Third, he shows the same thing from the good pleasure of the divine will saying, "As God pleased, so it has been done." For friends will and do not will the same thing. Thus if it is the good pleasure of God that someone should be despoiled of temporal goods, if he loves God, he ought to conform his will to the divine will, so that he is not absorbed by sadness in this consideration.
These three arguments are put in the proper order. For in the first argument it is posited that temporal goods are exterior to man. In the second, it is posited that they are a gift given to a man and taken away by God. In the third that this happens according to the good pleasure of the divine will. So one can conclude from the first argument that man should not be absorbed by sorrow because of the loss of temporal goods; from the second that he cannot even complain and from the third that he ought even to rejoice. For it would not please God that someone should suffer from adversity unless he wished some good to come to him from it. So though adversity is bitter in itself and generates sadness, nevertheless it should be the cause of rejoicing when one considers the use because of which it pleases God, as is said about the apostles, "The apostles went rejoicing because they had suffered contempt for Christ." (Acts 5:41) and so on. For when taking a bitter medicine, one can rejoice with reason because of the hope for health, although he suffers sensibly. So since joy is the matter of the action of thanksgiving, therefore Job concludes this third argument with an act of thanksgiving saying, "Blessed be the name of the Lord." The name of the Lord is truly blessed by men inasmuch as they have knowledge of his goodness, namely that he distributes all things well and does nothing unjustly.
Source: Commentary on Job