Because they were fighting for their survival and both are small countries, so it was better for them to remain separated from each other, Korea did not want to deal with contacting other countries because they were invaded before and Japan saw Europeans as crudes and Barbaric, different from their race, and later European wanted to take control of them, and these consequences kept both countries isolated from each other.