Clearly, $\mu, \nu$ are uniformly tight. Fix $\varepsilon >0$. There are $K\subset X$ and $L \subset Y$ compact such that $\mu(K^c), \nu(L^c) \le \varepsilon/2$. The product of compact spaces is compact, so $K \times L$ is compact.
We have
$$
\pi((K\times L)^c) = \pi ((K\times L^c) \cup (K^c\times L)) \le \pi (X\times L^c) + \pi(K^c\times Y) =\varepsilon \quad \forall \pi \in \Pi(\mu, \nu).
$$
So $\Pi(\mu, \nu)$ is uniformly tight.
Let $P^X, P^Y$ be the projections from $X\times Y$ into $X,Y$ respectively. Let $(\pi_n)$ be a sequence in $\Pi(\mu, \nu)$ such that $\pi_n \to \pi$ weakly where $\pi$ is Borel probability measure. We want to prove that $\mu, \nu$ are marginals of $\pi$, i.e., $P^X_\sharp \pi = \mu$ and $P^Y_\sharp \pi = \nu$.
Let $C_b(X)$ be the space of all real-valued continuous bounded maps on $X$. For each $f \in C_b(X)$, $f \circ P^X\in C_b(X\times Y)$. We have
$$
\int f \circ P^X \mathrm d \pi_n \to \int f \circ P^X \mathrm d \pi \quad \forall f \in C_b(X).
$$
It follows that
$$
\int f \mathrm d P^X_\sharp \pi_n \to \int f \mathrm d P^X_\sharp \pi \quad \forall f \in C_b(X).
$$
As such,
$$
\int f \mathrm d \mu \to \int f \mathrm d P^X_\sharp \pi \quad \forall f \in C_b(X).
$$
It follows that $\mu = P^X_\sharp \pi$. We can prove it another way. Let $A \in \mathcal B(X)$. Then $\pi(\partial (A \times Y)) \subset \pi(\partial (X \times Y)) =\pi(\emptyset) = 0$. So
$$
\pi_n (A \times Y) \to \pi(A\times Y).
$$
It follows that $\mu(A) = \pi(A\times Y)$.
Update: Above result directly leads to the following theorem.
Let $X,Y$ be Polish spaces, $c:X \times Y \to [0, +\infty]$ lower semi-continuous, and $\mu, \nu$ Borel probability measures on $X,Y$ respectively. Let $\Pi(\mu, \nu)$ the set of all Borel probability measures on $X\times Y$ whose marginals are $\mu, \nu$ respectively.
Theorem: The minimization problem
$$
\inf_{\pi \in \Pi(\mu, \nu)} \int_{X \times Y} c(x,y) \mathrm d \pi(x, y)
$$
has a solution.
Proof:
We have $\Pi(\mu, \nu)$ is uniformly tight and weak* closed. By Prokhorov theorem, $\Pi(\mu, \nu)$ is weak* compact. Consider the map
$$
\varphi:\Pi(\mu, \nu) \to \mathbb R \cup \{+\infty\}, \pi \mapsto \int_{X \times Y} c(x,y) \mathrm d \pi(x, y).
$$
Let $\pi, \pi_n \in \Pi(\mu, \nu)$ such that $\pi_n \overset{\ast}{\rightharpoonup} \pi$. By Portmanteau theorem, we have
$$
\int_{X \times Y} c(x, y)\mathrm d \pi (x, y) \le \liminf_n \int_{X \times Y} c(x, y)\mathrm d \pi_n (x, y).
$$
This means $\varphi (\pi) \le \liminf_n \varphi (\pi_n)$. So $\varphi$ is lower semi-continuous. The proof is complete by the direct method of compactness and lower semi-continuity.