Women were not legally prohibited from performing in Shakespeare's plays. The all-male stage was custom, not statute. Boys played female roles because the profession was structured that way—but historical evidence shows women did perform in certain contexts:
The restriction was social and professional, not legal. When the Restoration brought women legally onto the public stage in 1660, it ended a convention—not a law.