"God divided the commandments. Some apply to both men and women. Then there are some commandments from which men are exempt so that they may focus more on those activities unique to their purpose. Likewise, there are commandments from which women are exempt to allow them to accomplish more in the areas entrusted to them. Now, you might think that the reward for the commandments is awarded only to those who actually perform them. But the Torah declares, as the Arizal explains: the fact that women are exempt from some commandments doesn't mean, God forbid, that they have no share in them. Rather, when the husband performs those commandments he does so on behalf of his wife as well. As it is with kiddush on Shabbos: when one person recites kiddush he exempts all those who are listening to him as well even though they are merely hearing it. The same applies to the commandments from which women are exempt like the commandment to write a Torah scroll for instance. God established that women do indeed share in the benefit. They were only exempted from performing the actual deed for when the man fulfills it, he does so as a representative and on behalf of his wife.
But the question could be asked: Perhaps this only occurs after marriage when she has a husband? The Zohar states that this is incorrect. The souls of husband and wife were created like all souls in Heaven from which they then descended. In heaven they were created as one soul. They were separated into two bodies only when they descended into this world. And so Torah calls an unmarried man a half-body. And this is also true of the woman. And then, when the right time comes, God brings them together, for is He who ordains the match. This teaches us that even before marriage God knows that the half-souls of a young man and his future bride are part of one whole. So, even before marriage as the young man fulfills commandments in which only men are obligated he might not realize it. But God who gave prescribed commandments and their reward certainly knows that they are performed in part for him and in part for the woman, who, at the proper time, will be re-united with him to become one unit. So years before his wedding, and even during early childhood, when a boy performs a commandment incumbent only on men, it is done in part for his half-soul's female counterpart, and the same is true of the woman. (Lubavitcher Rebbe, Farbrengen of 26 Iyar, 5744, May 27, 1984 in "Two Halves of a Whole," Living Torah, 1657)