There follows the question. And first he presents the law; secondly, the case; thirdly, the question. They say, therefore, and they interrogated him, saying: master, Moses said: if a man die, having no son, etc. Deuteronomy 25:5 f. What was the reason for the law? The people were carnal. Hence they sought nothing but temporal things. The law, therefore, promised these. For it is manifest that a man cannot endure in himself; therefore it is a consolation to him that he may remain in his likeness, namely, in a son; and nature desires this, that what cannot be preserved in itself may be preserved... in its likeness. Hence it happened that someone died without a son; therefore Moses provided for this case according to this law, that his brother should take his wife. Nor was a stranger appointed, who had no relation to him; likewise, he would not have as much care for the household and family as a brother: and this is what it means when it says, and raise up seed to his brother, i.e., beget a son who would have the inheritance of that man.
Source: Commentary on Matthew