Phoebe and Monica were roommates, and Chandler lived in the apartment face to face. So the 3 of them knew each other since then. And later, Joe moved in with Chandler, so the 4 of them got familiar. You know the story after that, Rachel left her fiance at the alter and broke into the cafe. Now the last one is Ross, I don't mean Ross is the last one into the gang, he is elder brother of Monica, had crush on Rachel on high school, roommate of Chandler in college. So I think Ross knew Phobe later Monica and Phoebe became roommates. The ultimate puzzle is how Monica and Phoebe know each other and lived together. Here's the answer, the apartment Monica lives belongs to her grandma, so when she moved in, she posted ads to rent one of the bedroom, not sure Phoebe is the first one, but definitely one of them. By the way, there was another woman lived with Monica and Phoebe before, can't recall her name, but you can see her in Broke Sisters, the Polish woman.