Pick a row, and suppose it has $x$ 0s and $b - x$ 1s
then each column that intersects with this row at a 0 has $x$ 0s and $a - x$ 1s, while each column that intersects with this row at a 1 has $a - b + x$ 0s and $b - x$ 1s. In total, the table has $x^2 + (b - x)(a - b + x) = ab - b^2 + (2b-a)x$ 0s.
If $2b-a = 0$, that is, $a = 2b$, we have a valid pair: for an example, take two big squares, fill one with 0s and one with 1s, and put them side by side. Otherwise, $2b-a$ is nonzero, and since the number of 0s we calculate would have to be the same no matter which row we picked initially, every row must have the same number $x$ of zeroes.
Using a column instead of a row, we find either $2a-b$ is zero or every column also has the same number $y$ of zeroes. Again, $b = 2a$ yields a valid pair, so we assume every column has the same number of zeroes, $y$.
If the board is all 0s or all 1s, we immediately have $a = b$ along with a valid example. Otherwise, some row and some column intersect at a 0, so $x = y$, and some row and some column intersect at a 1, so $b - x = a - y$, and $a = b$ follows again.
Therefore, the pairs are exactly those satisfying one of $a = 2b$, $b = 2a$, and $a = b$.