TheThere are several interpretations of the link. We can divide it into three major interpretations.
Interpretation 1: Forbidding Unjust Marriage to Orphans
The context of the verse is that ina man who has an orphan girl under his care and wishes to marry her for her wealth or beauty. Allah forbade him from marrying her if he cannot do full justice by giving her the pre-Islamic timesdeserved mahr and treating her well. If he cannot guarantee full justice to her, the people usedhe should stick to marrymarrying other women.
Allah says: ⟪And if you⟫ feel like marrying an orphan girl but ⟪fear that you will not deal justly with the orphan⟫ girls and unjustly takeyou marry by giving them a mahr that is worthy of their wealth.status or treating them with the proper treatment wives deserve, ⟪then⟫ do not marry the orphans under your care, but rather ⟪marry those that please you of⟫ other ⟪women, two or three or four. But if you fear that you will not be just⟫ by giving the rights of each wife properly, ⟪then⟫ only ⟪one or those your right hand possesses. That is more suitable that you may not incline [to injustice].⟫
This interpretation is by Aisha (unjustly taking their wealthRA) was made forbidden by Allahand quoted in Sahih Bukhari (see here).
Interpretation 2: Forbidding Unjust Marriage in General Using the Fear of Mistreating Orphans
But the problemThe context is that if a person marries an orphan girl,people at the orphan might feel indebtedtime used to be very careful in treating orphans well and respecting their husbandproperty but did not have the same care and accept any dowry becausegood treatment of that. But that is also unjustwives. So, God told menAllah commands them to marry other woman rathertreat their wives fairly and limits marriage to four wives because marrying more than orphan girls if theythat would likely lead to injustice.
Allah says: ⟪And if you⟫ are cautious about treating orphans well and ⟪fear not dealing justly with the orphans⟫ due to the many severe commands regarding orphans in the Quran, then also remember to fear being unjust with women and ⟪marry those that please you of women⟫ only up to when there is no fear of injustice and that can only be up to ⟪two or three or four⟫ because marrying more than that will lead to injustice would happen. ⟪But if you fear that you will not be just⟫ even when marrying up to four, ⟪then⟫ only ⟪one or those your right hand possesses. That is more suitable that you may not incline⟫ towards injustice against women.
This interpretation is explainedreported from Ibn Abbas (RA), Saeed ibn Jubair, As-Suddi, Dhahhak, Qatadah, and Rabee’ in the tafsirTafsir of Tabari. The narration from Ibn KathirAbbas is through Ali ibn Abi Talhah. This is the interpretation that Tabari prefers as the most correct one.
Interpretation 3: Forbidding Many Marriages to Safeguard the Wealth of Orphans
The context is that some people in Jahiliyyah (pre-Islamic times) used to marry up to ten or more wives and, when that caused them financial trouble, they would be tempted to take some wealth from the inheritance of the orphans under their care. To safeguard the orphans from such injustice, Allah limited people from marrying more than four wives.
Allah says: ⟪And if you⟫ take care of orphans and ⟪fear that you will not deal justly with the orphans⟫ and might be tempted to take their money because you have too many wives to take care of, ⟪then⟫ limit yourself and only ⟪marry those that please you of women, two or three or four. But if you fear that you will not be just⟫ to the orphans even with four wives, ⟪then⟫ marry only ⟪one or those your right hand possesses. That is more suitable that you may not incline⟫ towards injustice to orphans.
Allah commands, when one of you is the caretaker of a female orphan and he fears that he might not give her a dowry that is suitable for women of her status, he should marry other women, who are plenty as Allah has not restricted him. Al-Bukhari recorded that `A'ishah said, "A man was taking care of a female orphan and he married her, although he did not desire to marry her. That girl's money was mixed with his, and he was keeping her portion from her.
This interpretation is reported from Ibn Abbas and Ikrimah. The narration from Ibn Abbas is through Atiyyah ibn Saad and Tawus. It is reported that Ibn Abbas said: “Men were limited to four wives because of the wealth of the orphans.” (Tafsir Ibn Abi Hatim)
Conclusion
Those are three major ways that the mufassiroon linked injustice of orphans to marriage and their opinions on why Allah connected them. See this article for a more detailed analysis of the interpretations along with a few more interpretations.
It is possible a combination of the interpretations are intended by the same verse.