What types of roles or purposes do women have in the play Hamlet?
I'm afraid, by our standards today, Shakespeare's Hamlet is quite a sexist play. Viewed from a feminist perspective, one might say that the play is the result of a patriarchal or male-dominated society.
The women in the play are victims at best (Ophelia) and dupes at worst (Gertrude).
Gertrude is full of lust, lacks loyalty, is fooled by Claudius, and is killed by mistake from Claudius's treachery.
Ophelia is dominated by her male family members, made by them to spy on Hamlet, goes along with it, is abused and ridiculed by Hamlet, loses her mind and commits suicide.
The action of the drama is furthered, for the most part, by male characters. Strictly speaking, the conflict is between two male powerhouses: Hamlet and Claudius. Women are peripheral.
In all likelihood, this was not an issue in Hamlet's day. From our contemporary perspective, though, the play is really quite sexist. Particularly in the "enlightened" Hamlet's view, the women are nothing more than whores.