The female told Glasgow Sheriff Court that after meeting Sterling Hall, 23, through the army they kept in touch.
She said they communicated using Facebook and met up once in Edinburgh where his barracks were.
In April 2010, after he returned from a tour in Afghanistan, Hall came to Glasgow to meet the girl, and stay at her flat.
The pair went out in Glasgow city centre where they met a friend of the witness. The court was told that they left the nightclub that they were in soon after because Hall was acting differently to the way he had behaved before meeting the girl.
She told the court it took a while to get back to the flat because his behaviour changed. She said it “became worse” and “he seemed quite aggressive”.
The jury were told that after getting home, Hall tried to have sex with her and she “froze” and did not know what to do.
Hall pleads not guilty to the charge of assault with intent to rape and has lodged a special defence of consent.
The trial before sheriff Johanna Johnston QC continues.