Some laws exist to enforce moral values, or at least the values that the legislature agreed were good. The answer by Dale M identified some of these.
Other law exists to enforce policy choices that cannot really be called 'moral'. For example, whether the tax rate on sales is X% or Y% is not really a moral issue. Whether the notice of the interest rate in a consumer loan document must be in 12 point or 14 point type is not a moral issue. Whether title to goods passes when the price is paid or on delivery is not a moral issue.
In any case, the legislature may take its view of morality into account when deciding what laws to pass. But once a law is in effect, it is (in modern times, at least) usually treated as a rule separate from any notion of morality, although one hopes that it is not against morality. It is unusual for a judge to modify the law to make it better conform with morality (in the judge's opinion). There are cases where legal rules which would otherwise be too harsh are modified. For example, courts may refuse to enforce contract terms that they consider "unconscionable" or "against public policy", even when there is no specific law prohibiting those specific terms. However, the trend has been towards doing this by a specific law passed by the legislature, not by the moral values of a particular judge.
(US Constitutional rights are something of an exception. What constitutes "due process of law", "cruel and unusual punishment", or an "unreasonable search" is largely a collection of the moral and ethical decisions of judges since the Constitution was adopted, plus some carried over from the English Common Law prior to that time.)
It is now somewhat unusual for a probate judge to overturn a legally executed will by a competent person on the grounds that it was not morally proper. In the US, at least, there is no duty to leave anything to one's children, and a person can leave everything to another person or some institution. I had thought that was also true in AZ, where it seems this took place. But judges, and particularly probate judges, still have a good deal of discretion.
Edit: It might be that in the will case mentioned in the question, the party wanting the will enforced as written could appeal and have the decision overturned as an abuse of discretion. Even in the US, I am not by any means clear on when an appeals court would do this: generally only when they feel that the lower court was far outside the limits of what is acceptable. I have no idea what the rules would be in Australia. If the testator had made specific statements about why he wanted to leave nothing to his daughters, that might be a factor.
Edit: Another answer says "With respect to wills, the law gives effect to the moral position that a person is required to adequately provide for their dependents in so far as they are able. That is, it is immoral for those dependents to be thrown on the mercy of charity or the provisions society makes in its laws about poverty." However, at least in the US, and I think in most countries, the law as such takes no such position. In one particular case a judge held that it was improper for a rich testator not to leave a sizable sum to his children. Another such will coming up before a different judge two days later may not be held to the same standard -- unless there is in fact a general principle here which is generally enforced in that jurisdiction, which the reports of the case did not mention. In several other jurisdictions, people can and do with reasonable frequency leave nothing to their children, and courts do not overturn these wills. The moral principle, if any, is that a person may leave his or her own property however he or she may choose, if of sound mind.