The main reason why Athena punished Medusa is the accusation that she performed a sexual act within the goddess' temple. As a virgin goddess, Athena would have perceived this as an act of desecration, which would explain why she was so angry with Medusa. However, Medusa did not engage in said sexual act willingly. Poseidon raped Medusa, arguably making Medusa the victim.  Despite what Poseidon did to Medusa, Athena held Medusa accountable for what happened in her temple. One can make the case that Medusa is the victim here because instead of being protected by her patron goddess, she was punished by Athena for being raped in her temple. To further build on Medusa's victimization, after Poseidon raped her, she sought Athena for guidance.  If Medusa's encounter with Poseidon were consensual, she would not be asking Athena for her guidance. Arguably, this course of action attests to the trauma she encountered and her status as a victim in this situation.
Despite Medusa's portrayal as a victim of rape, this portrayal is not universal. Another version of the Medusa myth told by the Greek poet Hesiod tells a different story. In Hesiod's rendition, Medusa and Poseidon share a more consensual relationship where both parties are found together in a more comfortable setting.  Hesiod's choice of setting paints a different picture, specifically, one that does not allude to rape. The poet's choice of words betrays that narrative when he describes the beauty of the scene. In light of this portrayal, one can argue that Medusa's relationship with Poseidon was consensual.