Judah's command to Onan reflects an ancient custom known as Levirate marriage, which existed long before the Law of Moses. Commentators explain its purpose was to provide an heir for a brother who died childless, thus preserving his name, family line, and inheritance. This was considered a vital act of familial honor and continuity in that culture.