You shall count for yourselves - from the day following the holiday, the day when you bring the omer as a wave-offering - for seven complete weeks. Until the after the seventh week you shall count - fifty days…. (Lev. 23:15-16)
When the Israelites left Egypt, they left their state of spiritual impurity….
This is the commandment to count the Omer, as the Sages have determined (Sukka 58b). The mystical secret is this: even though the Israelites purified themselves in order to make the Passover offering, thus leaving the realm of spiritual impurity, nevertheless they were not at the proper level of perfection and purity.
They were, nevertheless, able to offer the Passover lamb because the illumination that flows forth from the sefirot comprising the upper three sefirot of higher consciousness (chochma, bina, and daat) was not dependent on the merit of the Israelites; instead it flowed forth as a product of G‑d's kindness (Ramaz).
This is also the reason that we do not complete the Hallel prayer after the first day of Passover, because they had not yet reached the proper level of perfection.
This [seven week purification period] is comparable to the seven pure days of a woman after menstruation. Once her cycle finishes, she starts counting [seven days].
So too, when the Israelites left Egypt, they left their state of spiritual impurity. They celebrated Passover, partaking of the food of their Father (See Sifri Zuta, Nasso 57), and from then on they counted the days until the wife [the Jewish People] can approach her Husband [G‑d]. These are the fifty days [until the day following the completion of the seven weeks of counting the omer] of purification that enable a person to enter the World to Come [alluding to the level of bina] and receive the Torah, and enable the wife to come to her Husband.
The fiftieth day is the secret of the Torah itself….
Since these are the days of the male world [the world of the seven sefirot of Zeir Anpin] this counting is incumbent upon men only (see Magen Avraham, Orach Chaim siman 489). And for this reason also one must count standing up, for matters pertaining to the Lower World are done when sitting down, not standing. This is the mystical secret of [the difference between] those parts of prayer that are said standing, and those that are said sitting.
Now these fifty days comprise forty-nine days of the facets of Torah, but the fiftieth day is the secret of the Torah itself… Now if you question if these fifty are not only forty-nine [i.e. seven weeks of seven days each equals 49, the answer is that] one of them [the Fiftieth Gate of Bina - see Rosh Hashanah 21b, Nedarim 38a ]is hidden, and the entire world rests upon it. On this fiftieth day [the day that the Torah was given], what was hidden within became revealed, like the King who enters into the chambers of the queen and remains there.
The essence of the Torah, compared here to the King Himself, was forever given to the queen, the Jewish people.
That is the meaning of this mystical idea.
[Based on Raya Mehemna, Zohar III:97a-b]