In Twelfth Night, gender is attached more to roles than to biology, which is why gender is attached more to clothing rather than to biology. True of society in the past, women in Twelfth Night were expected to uphold the roles of being wives and mistresses of the households. We can especially see the roles of women alluded to in the fifth scene of Act 1, the scene in which Viola as Cesario comes to Olivia to deliver Duke Orsino's message of courtship.
We especially see the role of women referred to when Viola asks Olivia to confirm that she is indeed the lady of the house. Olivia's witty reply is that if she does not overthrow her own self's power, then she certainly is the lady of the house. Viola then retorts that if she is lady of the house, then she certainly is "usurping," or wrongfully using, herself because she has no right to "reserve," or keep her own hand in marriage, meaning that she has no right to refuse marriage, as we see in Viola's lines, "Most certain, if you are she, you do usurp yourself; for what is yours to bestow is not yours to reserve" (eNotes, I.v.175-76). In other words, Viola is claiming it is Olivia's duty as a woman to marry, especially someone like Duke Orsino. Hence, it is this duty as a bride that distinguishes a woman's gender, rather than biology. We even see the role of women as a bride referred to later in this scene when Viola chastises Olivia for not passing on her beautiful genes through both marriage and birth, showing us again that, customary to society, gender is recognized with respect to roles, which are also portrayed by clothing, rather than to biology.