Was the purpose to curb women's display of wealth on moral grounds? Was the Roman treasury starved of money during the second Punic war/ was there similar measures on men? The Punic war ended in 201 BC, yet the law wasn't repealed until 195 BC. Why?
The lex Oppia was just the first in a long series of laws of that type going down to the middle of the second century BCE, ending perhaps with the lex Licinia of 140. These laws are termed sumptuary laws, because they all generally deal with the regulation of luxuria. In this period, Rome's urban elite had become not just rich, but super-rich, and the numbers of "rich" men both at Rome and among the Italian allies had grown steadily with Rome's expanding fortunes. With that wealth came new mores, new affectations, new modes of display, most of which were out of sync with the traditional, rustic, austere mores of the Old Republic. The question of wealth and wealth display was intensely debated among the Roman/Italian elite in this period, with one faction supporting the change in traditional practices, and the other side (like Cato) supporting a rejection of new cosmopolitanism in favor of old, more austere values. The lex Oppia targeted women because, first, they were an easy target, and second, because the behavior of women in particular in this period was low-hanging fruit for those interested in demonstrating just "how far" the behavior of the elite had progressed.
The law itself stipulated that no Roman woman was to possess or "have" (habēre) more than about 15 grams of gold, that she should not wear multicolored garb in public, and should not get carried around in a carriage except on religious business. The purpose of the law and its intent have been debated often in modern times. The historian Livy (34.1.3) presents it primarily as a war-time emergency measure to free up more funds (literally gold weight) for use in the war. Modern historians wonder how that would have worked: did soldiers burst into the Palatine houses of wealthy families and raid the woman's jewelry box? Surely not. The stipulation about clothing is clearly more tied to social behavior and mores than actual monetary value. Modern Livy scholars place his discussion of the lex Oppia within a larger framework he is spinning about the decline of traditional Roman values, especially among the elite, and we see this narrative framework writ large in the debates he presents for the dissolution of the law in 195, during the consulship of Cato and Valerius Flaccus. It is basically a set-piece for his larger point, and what the law actually was or was meant to accomplish is somewhat obfuscated by this larger agenda.