They also differ as to exterior solicitude, because the five foolish, having taken their lamps, did not take oil with them. All of these wished to have their lamps burning, because he who is the light wills to be served with light; but light cannot be nourished without oil: for he would be foolish who believed he could keep light in a lamp and not put in oil. By oil four things are signified. According to Jerome, by oil good works are signified. And why? Faith is the light of souls by which the lamps are kindled. By good works faith is nourished; 1 Timothy 1:18: this precept I commend to you, ...O my son Timothy, according to the prophecies going before on you, that you war in them a good warfare, having faith and a good conscience, which some rejecting have made shipwreck concerning the faith. From this can be taken what is said in Proverbs 21:20: there is a treasure to be desired, and oil in the dwelling of the just, and the foolish man shall spend it. In another way, by oil mercy is signified: and this is what Chrysostom says. Hence it is had in Luke 10:34 that the Samaritan poured in wine and oil. By wine severity is signified, by oil the work of mercy. He wills, therefore, that he who intends to preserve continence and has not performed mercy is foolish. Hence James 2:13 says: judgment without mercy to him that has not done mercy. Likewise, by oil interior joy is signified, concerning which Psalm 103:15 says: that he may make the face cheerful with oil. And elsewhere in Psalm 44:8: God has anointed you with the oil of gladness. Many are those who abstain outwardly and seek joy within, namely, of conscience, and there they have oil with them. But others do not seek the joy of conscience but the glory of men, and these do not have oil. According to Origen, by oil holy doctrine is signified; Song of Songs 1:2: your name is as oil poured out. The oil of justice signifies right doctrine; Psalm 118:11: in my heart I have hidden your words. Hence they are called virgins who preserve continence, who perform mercy, who seek interior joy, who take up right doctrine.
Source: Commentary on Matthew