By militarily conquering territory to expand the frontier to more easily defensible Eastern terrain like the Alps or the Rhine or through diplomatically controlling external threats.
In addition, the mountains and rivers helped make areas of the country defensible against nomads and marauders. Therefore, it became a center of early and advanced civilization.
So Poland's greatest geographic challenges to overcome have always been establishing a base on the coast and balancing the area's poorly defensible flat terrain against outside attacks from strong powers in every direction.