In this passage the writer contrasts youth with its joy and advantages and old age with its trouble and disadvantages. Youth must be lived with a conscious recognition of the approach of death (11:8) and of judgment, whether eschatological or the continual vicissitudes of life (v. 9). Qoheleth does not see such a mindset as destructive of joy. To the contrary, youth can be enjoyed only as reminders are given both of its beauty and transience.
Further, it is critical for the Creator to be remembered during youth. This is not simply a mental exercise; it is a deliberate act of committing the self to the source of its origin—to God. Such a commitment must be made while life is still enjoyed and the faculties and capacity to know and serve God are at their fullest. The days of trouble—the decline and restraining years—will come (12:1).
Beginning with 12:2 the frailty of old age is presented in a series of pictures. The diversity includes the aging of various parts of the body, the destructiveness of an approaching storm, and the ruin of a wealthy estate due to the failure of its guardians. All emphasize the same—the debilitation of the body because of old age.
V. 7 is a reversal of Ge 2:7. Humankind returns to dust, and the dust returns to the ground. Since God gave the spirit, he also has the power to reclaim it. Minimally the spirit refers to the breath of life, the animation of the body God provided (Ps 104:29). From a NT perspective, more will be read into this return of the spirit to God.