Yes it’s a command to marry her assuming she has no male children already... If she does have male children then it’s at the discretion of the man. But if she is young she should be married...
I’m not certain its quite that simple.
I think that there are a lot of assumptions made if one is looking only in the Deuteronomy 25 passage. It does contain quite a bit of information, but one should be careful what is assumed from lacking information in the passage. It definitely does not answer all pertinent questions on the topic.
For example, a woman is bound to her husband only until his death per Torah. Assuming she has no choice (in Levirate marriage) contradicts this principle. There is also the assumption that she had no choice in the matter of her first marriage and as such has no choice in his replacement. There is also the possibility of returning to her fathers house as we see in Genesis 38:11 (yet another passage that generates a lot of assumptions)
There are several reasons why a widow without a child would want to be married to a brother. If she remained single, she would have to be able to find another husband on her own which would no doubt be a daunting task and could be very dangerous without a protector like her father or brother to intercede for her. She would also be ineligible for any kind of asset inheritance due to Numbers 27:8&9. If she didn’t have her own money/inheritance, she would be penniless other than her ketubah (about 200 zus). Thus it seems that she would be better served by marrying again within the family because she had no security unless she provided someone to inherit. According to Numbers 27, that could be either a boy or girl from her deceased husband. A woman deciding to be part of Levirate marriage rather than returning to her fathers house would most likely be doing so out of a desire to continue her deceased husbands name thru a son.
There could also be many reasons why a widow without a child would refuse to have a child with any of her husbands family. A phrase that is grossly overlooked is the first qualifier.
If brethren dwell together . And one of them die. And have no child . . . . These are the qualifiers for the specific instance of Levirate marriage mentioned in Deuteronomy 25. However, there are obviously other instances that could be addressed that would also fall under the category of Levirate marriage. Such as, the brethren do not dwell together, or there have been children born to the deceased husband. There is nothing wrong with a brother bringing his sister in law into his household and fulfilling the obligations IF that is the understanding between him and the widow. And there is nothing wrong with doing so if the situation does not match the exact one listed in Deuteronomy. The possibilities are unlimited as to how a brothers household could be structured (including platonic provided there is no son) and still qualify as a Levirate setting.
This is a prime example of “should” does not necessarily equal “must”