Souls are troops collected together and those who familiarised with each other (in the heaven from where these come) would have affinity, with one another (in the world) and those amongst them who opposed each other (in the Heaven) would also be divergent (in the world). (Using translation from Muslim 2638a)
"إِنَّ الأرواحَ جُنود مُجندَة فَمَا تَعَارَفَ مِنْها ائْتَلَفَ، وما تَناكَرَ مِنْها اخْتَلفَ ".