Ophelia is a foil of the Queen in so many ways. Gertrude is an interesting character by the way she lives her life. First of all, in my honest opinion, she is having an affair on her late husband with his brother no less and then she quickly marries Claudius. Ophelia, it seems, has an affair with Hamlet and then when he rebuffs her she is thrown off by him. That is also seen with Gertrude. When Hamlet the first died, Gertrude needed to latch onto a man, and since it was her dead husbands brother (in which whom she was having an affair with) would be king, she needed to attach herself to him just to keep up with the life that she was accustomed to leading.
You can also see that both women are subservient to the men in their lives. Gertrude talks to her son and tries to push him off the trail of her husband Claudius.
Ophelia spies on the man that she "loves" because her father, Polonius, tells her to. Ophelia listens and acts stemming from what her brother, Laertes tells her to.
Both are mad in different senses. Ophelia is driven to craziness by both the deaths of her father and brother and the fact that Hamlet seems not to be interested in her anymore but seeks more of revenge for his father's death. There defiantly has to be something wrong with Gertrude for her to run from the funeral of her husband and literally the marriage bed with his brother.