IT seems that you were not satisfied with the answers provided. And I detect in the forum a sweet trust in God that just says, "God said it so it is then significant." I think I can connect the dots a bit for you to show you how it is that God ascribed meaning to these words. Perhaps, after I am done, a true Hebrew scholar can pick up the ball and iron out the wrinkles for you:
Related question
We see by how Adam named--words are assigned based on what they represent. He sees the creature God presents to him and he calls her woman because she came from man. He names her eve because she is the mother of all living. (The Hebrew word for Eve means life).
Seven happens to be a word we can similarly see how its significance was attached to it.
And God completed on the seventh day His work that He did, and He
abstained on the seventh day from all His work that He did.
בוַיְכַל
אֱלֹהִים בַּיּוֹם הַשְּׁבִיעִי מְלַאכְתּוֹ אֲשֶׁר עָשָׂה וַיִּשְׁבֹּת
בַּיּוֹם הַשְּׁבִיעִי מִכָּל מְלַאכְתּוֹ אֲשֶׁר עָשָׂה:
Seven first appears on the seventh day to which it is assigned. We think of "seven" as though it is merely a number. But if we look at the linguistic connections in the context where it first appears (see the Hebrew highlighted above) we discover something. The consonants-- בֹּ and בִ are linguistically connected. If I am not mistaken, in the unpointed Hebrew text, they are identical. So while it looks in the transliteration like two different unrelated words, Shv and Shb actually show themselves in the visible text to be alike.
IT is difficult to know if the variations vocally existed in the beginning of time. Perhaps the vocal variation was assigned the very day of the event recorded in Genesis 2 in order to distinguish between what would come to be a number carrying a connotation of ceasing, and the word ceasing itself. The variations may have developed over time like dialects in regions develop and sounds of words alter slightly as people distinguished between using the word as a number and using it to actually say ceasing. Then they were employed to record the event. In any case, we have today unpointed Torah scrolls and pointed texts. One demonstrates visual similarity. The other vocal differences. I don't have access to unpointed script to demonstrate it, but if you remove the vowel pointings and the dagesh you can see the shared root: שְׁבֹּ and שְּׁבִ
In the very least, we can see how the word seven itself acquired a meaning that it continues to carry through out Torah, by virtue of being assigned to the day to which this word was assigned--a day first identified as the one on which God rested/ceased.
If we could see it in English it might be something like,
day one
day two
Day three
Day four
day five
day six
day cease
And God completed on the cease day His work that He did, and He ceased
on the cease day from all His work that He did.
We see how then how also Sabbath/Shabbat-- שַׁבָּת --got its significance as a word. coming over to English I understand it:
Remember the ceasing day to keep it holy for in it God ceased from all
his labor.
The seventh day received its name by its purpose God assigned it and for which He sanctified it. He blessed it because in it He rested. Thus, Seven means rest, and Shabbat, is the day on which we rest.
I have only considered the source of the significance of the word seven, and nothing about forty. Again, I am not a rabbi; I was not born a Jew; I am not a Rabbinic scholar. I took a linguistics course in college that taught me some basic common linguistic connections between v and b (and between V a U and between U and double W, W and double v etc). So, this is just the limited knowledge I brought to the text when I encountered it, and it leads me to suspect this is how they acquire their meaning.
As for all the rest of the sevens, once seven has a meaning of rest, it carries that wherever it goes, the seventh month, the seventh year, the seventh seven years, they are all respectively times of rest. One might argue it carries a connotation of a blessed rest, for those who enter into these appointed times--
"Shabbat shalom!"
As for forty, I have no insight.