There are a few people that asked themselves why this scene happened like this. It was not such a big shock, but still enough to begin asking questions of it. J.J. Abrams, co-writer and director had a talk with Slashfilm and explained it all in detail.
“That was probably one of the mistakes I made in that. My thinking at the time was that Chewbacca, despite the pain he was feeling, was focused on trying to save Finn and getting him taken care of. So I tried to have Chewbacca go off with him and focus on Rey, and then have Rey find Leia and Leia find Rey.” It’s still not that clear. Fans, like me, now speculate if they didn’t know each other before everything that was happening. My plot? Well, I think that Rey and Kylo even knew each other and somehow they don’t remember a piece of their/her past and that’s why Leia went to hug her.
But, nothing is sure until we see the next movie on December 15, 2017!