This phrase is used when you have encountered the same people, events, or situations in an unexpected place or you have discovered that someone knows a person you also know.
For example:
I didn’t know that James was your brother! It’s a small world! I met him when we were at university.