If you want to go to a university abroad together with another student, how would that work? Do you just have to hope you both get accepted to the same university?

Yes, you indeed hope you both get accepted. Chances of you both getting accepted to the same
university will be higher if you don’t go to a popular country/ university, or a university with
limited places.