The custom described in this verse is known as the law of levirate marriage. If a man died and he and his wife had no children, his brother was expected to take his widow as his wife. This would keep the deceased man’s property in the family and possibly produce sons who would carry on his family name (Deuteronomy 25:6).
This custom was not binding in an absolute sense on a dead man’s brother. But if he refused to marry his brother’s widow, he was branded by having one of his sandals removed (Deuteronomy 25:9-10). This signaled to others that he had failed to assume his family responsibilities.
DEUTERONOMY 25:5 – If brethren dwell together, and one of them die, and have no child, the wife of the dead shall not marry without [outside the family, NIV] unto a stronger: her husband’s brother shall go in unto her, and take her to him to wife, and perform [fulfill, NIV] the duty of an husband’s brother unto her.