What is the significance of Yibum (which Yehudah initiated - Ramban)?
Ramban: Yibum is one of the Torah's secrets, connected with reincarnation. In fact, it entails bringing down the Neshamah of one's deceased brother. 1
Ramban: Before the Torah was given, it could be performed by any relative (Yehudah was not Er's brother). It is an act of kindness towards one's deceased relative, and refusing to do so displays cruelty, which explains the Chalitzah ceremony.
What was Yehudah's command to Onan?
Malbim: He should do the Mitzvah of Yibum, and establish seed for his brother, to benefit the soul of the deceased.
Ha'Emek Davar: Onan did not want her for a wife. Yehudah said that even so, he should do Yibum, and he may divorce her after one Bi'ah with her. 1
If so, why did Yehudah add "and establish seed for your brother"? Perhaps he sensed that Tamar would become pregnant from the first Bi'ah, like she did later! (PF)