There were a few reasons why women were not allowed to perform on stage. One reason was that it was considered to be immodest for women to appear in public in front of men. This belief was based on the idea that women should be chaste and modest, and that appearing on stage would expose them to the gaze of men.
Another reason why women were not allowed to perform on stage was that it was considered to be a man's profession. Acting was seen as a skilled trade, and it was believed that women were not capable of achieving the same level of skill as men. This belief was also based on the idea that women were intellectually inferior to men.
Finally, there was also a practical reason why women were not allowed to perform on stage. In Shakespeare's time, theatre companies were often travelling troupes, and it was simply impractical for them to have women in their companies. Women would have required separate accommodations and chaperones, and they would have been more vulnerable to attack while travelling.
As a result of these factors, all female roles in Shakespeare's plays were performed by men. Some men specialized in playing female roles, and they were known as "boy actors." These actors were usually young men who had not yet grown beards, and they were able to convincingly portray women on stage.
The practice of using men to play female roles continued in England until the Restoration in 1660. After the Restoration, women were finally allowed to perform on stage, and they quickly became some of the most popular actors in the theatre.