The story does not criticize the women simply for sleeping. All ten become drowsy and sleep, including the five Jesus calls wise.
The distinction appears when the bridegroom finally arrives: one group has made provision for a longer wait and the other has not.