[guided]The goal of this step is to justify compactness later. In finite-dimensional Euclidean space, compactness follows from being closed and bounded, so we verify those two properties directly from the constraints defining $\Pi(a,b)$.
First, we name the constraint maps. For each row index $i \in \{1,\dots,m\}$, define $R_i: \mathbb{R}^{m \times n} \to \mathbb{R}$ by
\begin{align*}
R_i(P) := \sum_{j=1}^{n} P_{ij}.
\end{align*}
This is the map that records the total mass in row $i$. For each column index $j \in \{1,\dots,n\}$, define $S_j: \mathbb{R}^{m \times n} \to \mathbb{R}$ by
\begin{align*}
S_j(P) := \sum_{i=1}^{m} P_{ij}.
\end{align*}
This records the total mass in column $j$. Finally, for each pair $(i,j)$, define $E_{ij}: \mathbb{R}^{m \times n} \to \mathbb{R}$ by
\begin{align*}
E_{ij}(P) := P_{ij}.
\end{align*}
The maps $R_i$, $S_j$, and $E_{ij}$ are linear maps on the Euclidean [vector space](/page/Vector%20Space) $\mathbb{R}^{m \times n}$, hence they are continuous.
Now rewrite the feasible set using these maps:
\begin{align*}
\Pi(a,b)
=
\left(\bigcap_{i=1}^{m} R_i^{-1}(\{a_i\})\right)
\cap
\left(\bigcap_{j=1}^{n} S_j^{-1}(\{b_j\})\right)
\cap
\left(\bigcap_{i=1}^{m}\bigcap_{j=1}^{n} E_{ij}^{-1}([0,\infty))\right).
\end{align*}
This formula says exactly that every row sum is prescribed by $a$, every column sum is prescribed by $b$, and every entry is nonnegative. The singleton sets $\{a_i\}$ and $\{b_j\}$ are closed in $\mathbb{R}$, and the interval $[0,\infty)$ is closed in $\mathbb{R}$. Because continuous preimages of closed sets are closed, every set appearing in the finite intersection above is closed. A finite intersection of closed sets is closed, so $\Pi(a,b)$ is closed in $\mathbb{R}^{m \times n}$.
Next we prove boundedness. Let $P \in \Pi(a,b)$ and fix $i \in \{1,\dots,m\}$ and $j \in \{1,\dots,n\}$. Since $P$ is feasible, all its entries are nonnegative. Therefore a single entry is bounded above by its full row sum:
\begin{align*}
P_{ij} \leq \sum_{k=1}^{n} P_{ik}.
\end{align*}
The row-sum constraint gives
\begin{align*}
\sum_{k=1}^{n} P_{ik} = a_i.
\end{align*}
Since $a \in [0,1]^m$, we have $a_i \leq 1$. Combining these facts gives
\begin{align*}
0 \leq P_{ij} \leq 1.
\end{align*}
Because this holds for every entry, $P \in [0,1]^{m \times n}$. Thus $\Pi(a,b) \subset [0,1]^{m \times n}$, and consequently $\Pi(a,b)$ is bounded.[/guided]