Job had finished his investigation with the statement that he has suffered a great many tribulations regardless of the fact that he is just or unjust. He wants to ask if this can be true lest anyone could believe that God rejoiced in his tribulations. It would seem unfitting that someone would cause an effect as his own to treat it evilly, because every agent rather intends the good in its effect. This supposes, however, that he is the work of God as he made clear in the foregoing arguments. (vv. 3 and 4) So he asks him, "Why did you take me from the womb," as if to say: Did you cause my birth... in order to subdue me with trials? Because someone could object that absolutely considered (simpliciter) it is better to exist even in tribulations than not to have been born at all, he rejects this opinion saying, "would that I had perished," in my mother's womb, "so that no eye would see me," so as not to suffer shame from the great evils which the eyes of men contemplate in me.
Source: Commentary on Job