The decision is entirely justified. It will certainly deter many men,and not only in Egypt, who believe they have the right to harass women sexually. However, we may think that the sentence is a bit stiff.
Some women, who also agree with the sentence, suggest that it might be shortened if the man apologizes publicly, on television for instance, not just to his victim, but to all women. If a panel of members of women's rights groups then decided that his repeated apologies can be accepted, they could ask the judge to reduce his prison term.
Combining hard labor, which can be a very unpleasant experience, and public humiliation, would certainly be a very exemplary punishment and make most men think twice before they decide to grope women.