Hume is perhaps most famous for launching a series of attacks on reason, denying, for example, that morality was a matter of reason, and thus, along with his colleagues in the Scottish Enlightenment, ushering in solid British empiricism and ending the dominance of that funny Continental rationalism, in particular, perhaps, of natural law theory. I think that Hume's attacks only really work by stripping reason of any actual content, and thus settling the debates in his favour before they really start, but that's partly by the by here. Rather devle into Hume's epistemology, and the wisdom of claims like 'it is not contrary to reason to prefer the destruction of the whole world to the scratching of my little finger' - well, for one thing, if the whole world is destroyed, there won't be any little fingers to be scratched, so even on Hume's account it is irrational - I want to look at his account of justice, which does form part of his attack on rationalism, because it denies there is anything natural or rational about justice at all.
Hume claims that justice is an artificial virtue, made up of the observation of conventional property rights, which have nothing to be said for or against them apart from their character as solutions of collective action problems, and a practice of keeping promises, whose justification is similarly utilitarian. He effectively constructs an anthropology of the emergence of states in much the same way as natural law theorists like Hobbes or Locke, but denies that there is any determining element of reason or nature in the methods by which humans leave the state of nature. Specifically, he argues that because of justice's systematic character, it cannot be justified directly from the natural virtues of self-love or benevolence - which are of course not based on reason but the passions anyway - because if justice consisted in self-love, we would not obey it when it was not in our interests to do so, and if it consisted in benevolence, we would not obey it when it required actions like giving a rich miser property from a poor man, because the poor man could make better use of the property. Since justice does not flow directly from these, natural, virtues, and otherwise stands in want of both motivation and justification - which Hume effectively collapses - it cannot be a natural virtue. Thus the anthropological story comes in.
The anthropological story portrays justice as a solution to collective action problems, as I have already mentioned, in much the same way as Locke and Hobbes: conflict over possessions leads to uncertainty, which leads to less productivity and so less happiness. The collective action problem forms a kind of assurance problem, where although it is better for all to cooperate, it can be dangerous to cooperate when others defect, as it leaves you vulnerable to exploitation, but because conflict is not as endemic in Hobbes's state of nature - in which life is infamously 'nasty, brutish and short' - a gradual process of learning through isolated incidents of cooperation can eventually set up a set of institutions of justice. Hume's best example of this idea is of two men in a boat rowing: initially, they will not row together, and so the boat will go round and round in circles, but should they by accident take a stroke together, they will be able to see that they can both benefit from cooperation.
The important thing though is that Hume maintains that whatever institutions of justice are set up are effectively totally random: property rights are granted to those who have possessed things for a long time not because those who have possessed things for a long time should be given property rights, but because our minds naturally pass from the person to thing simply through the fact of long association. Likewise with inheritance: when a person dies, we naturally think of their close family, who after all have benefited from the property they had too, and so we pass their property on to the close family. This is what makes justice artificial for Hume, that there are no independent reasons for just institutions, that they are simply products of our fancies. This is not to say, for Hume, that justice does not acquire reasons for it: the experience of living in just institutions, through our benevolence and our self-interest, because we recognise that it creates benefits both for us and for others, generates support for those institutions. It is just that initially, there is nothing more than convention to be said in favour of it.
There's also another sense in which justice is artificial for Hume, though, which further undermines the natural law claim that justice is natural. Not only is justice not natural in the sense that it arises from convention, so that it would be nonsensical to speak of any obligation to be just before those conventions, but it arises from convention in quite specific circumstances. The circumstances in question are those of limited scarcity and limited altruism, because in a situation of abundance and perfect altruism, there would be no conflict, and so no need for conventions to prevent it, and in a situation of total scarcity or of perfect egoism, conflicts would be unresolvable, because nothing could compel people to obey the conventions which could, in another situation, resolve them. Although I think it is reasonable to be skeptical about the second half of this claim, simply because I don't collapse justification and motivation in quite the same way as Hume, the first half of it seems reasonable: justice does just seem to be the virtue of resolving conflicts amongst other values, which makes it artificial in a way, as it is not itself one of first-order values.
Hume's claims about the artificiality of justice could be made in another way, which is probably more realistic, yet undermines the attack on the rationalism of natural law theory. Rather than stress the anthropological story about the emergence of justice de novo as it were, we could stress the expansion of institutions of justice as family groups gradually grew in to minature societies. This would be more realistic, as it seems implausible that any group of any sort could last for any significant time without some institutions of something like justice, in particular promising, because even in relatively solidaristic groups like extended families, conflicts, and so justice as their solution, arise. Doing this though, would undermine the idea that justice is totally conventional, because it would not be prior to the existence of humans, assuming that humans have always lived in groups of some sort. However, undermining the idea that justice is totally conventional, at least in the historical sense of not having always existed in some form, undermines the critique of natural law theories, because there is a meaningful sense in which justice is natural: it has existed as long as humans have.
We could also make Hume's argument that justice lacks a motivation rather less radical, by, in line with his claim about justice being the virtue of resolving conflicts, pointing to the intrinsic conflict between the two motivations he accredits humans with, self-love and benevolence. Justice would then be motivated partly by self-love and partly by benevolence, as indeed Hume believes it is contemporarily, and would no longer be so radically inexplicable, which would clearly bolster the natural law arguments, because they would be able to attempt, at least, to explain justice motivationally. Neither of these arguments totally rescue the natural law theorists, because of Hume's argument against reason as a motivational basis for morality and because of his arguments against governments being based on consent (they're based on their usefulness, which is surely the only basis on which we would consent to them anyway, which would then undermine the importance of consent as an independent standard apart from their usefulness). But despite Hume's claims about the artificiality of justice, and the prominent place which that appears to take in his attacks on the rationalism of natural law theory, it's not actually that significant a threat to natural law theory, because there are relatively easy ways to interpret his arguments as not being particularly threatening to natural law theory.