If a man dies without children, there is a mitzvah for his brother to marry the widow. This mitzvah is called yibum in Hebrew or levirate marriage in English. (“Levirate” comes from the word “levir,” meaning a brother-in-law; it has nothing to do with Levites.)
There are quite a lot of factors that go into the obligation to perform yibum. First, the deceased must not have left any descendants. If he has children or grandchildren from a previous marriage, there is no obligation of yibum. The brothers must have co-existed; if the surviving brother was born after the married brother died, there is no obligation of yibum. If the widow is pregnant, all bets are off, so they must wait three months before performing yibum to ensure that she is not expecting. If she has a baby that survives even briefly, there is no obligation of yibum. If the deceased was married to someone prohibited to the surviving brother, such as his mother-in-law, there is no obligation of yibum. There are many more mitigating conditions.
The reason for this mitzvah is that God, in His kindness, desires for us to give the deceased an heir in the spiritual, if not the physical, sense. If his brother, who shares his DNA, marries his widow – the deceased’s “better half” – all three of them have a share in the merits of the children from the union.
The couple was not coerced to marry; there was an alternative that will be discussed in the next mitzvah.
This mitzvah applies in all times and places. It is the topic of the Talmudic tractate of Yevamos. It is codified in the Shulchan Aruch in Even Ha’Ezer 165-166. This mitzvah is #216 of the 248 positive mitzvos in the Rambam’s Sefer HaMitzvos and #45 of the 77 positive mitzvos that can be observed today as listed in the Chofetz Chaim’s Sefer HaMitzvos HaKatzar.