Widows and orphans are common issues in InDesign and can often be difficult to get rid of. Fortunately, there are a few steps you can take to fix them.
The first step is to adjust the paragraph settings. In InDesign, you can find the paragraph settings by selecting the text box and then click the "Type" drop down menu and select "paragraph". In the paragraph settings, you'll find the "widow/orphan control" option. This allows you to set a minimum number of lines for the widow and orphan, so it won't appear if a paragraph ends with fewer than that number.
The second step is to adjust the page margins. Widows and orphans are less likely to appear if you increase the page margins, because it will give the text more space to fit on the page. Similarly, if you decrease the page margins, you'll reduce the chances of widows and orphans appearing.
The third step is to adjust the leading. Lowering the leading - or distance between lines - will make it easier for the text to fit on the page. Similarly, increasing the leading can fix some of the widows and orphans you may be seeing, as it will make lines less likely to break.
Finally, if you still see widows and orphans, you can try manually adjusting the text. This can be done by selecting the widow or orphan and altering the line, manually adjusting the margins of the page, or adding a page break.
Using these steps should help you to fix any widows and orphans that may appear in your InDesign document.