It’s a straightforward (pun!) metaphor for doing what is right and typically what God commanded.
The Old Testament law gives consideration and protection to the disadvantaged, such as these three groups, as well as servants and the poor. (This particular phrase, “the sojourner, the fatherless, and the widow,” comes up a fair bit.)
These are the most important two verses in the entire Old Testament, even the whole Bible. I will dare to say there is not a Jew past or present who would disagree.
God appears to Moses on Mount Horeb and Mount Sinai. In a very different, and yet very similar way, Mount Zion is where God is, also. I’ll do my best to sort this out.
I found 13 events that lasted 40 days or 40 years. In some cases, the two are plainly connected. There may be more.