Inspired by my answer to a more general puzzle.
This is a stream-of-consciousness answer showing exactly the thought process needed to find the solution. If you just want to know the answer, skip to the end.
Let's label the 4 different groups of detainees by A, B, C, D, and look at how we might place them in the 48 cells provided. First of all, note that any $2\times2$ square of cells must contain each of A,B,C,D exactly once. So we can start off with:
A B * * * * *
C D * * * * *
* * * * * * *
* * * * * *
* * * * * * *
* * * * * * *
* * * * * * *
Now the first two cells in row 3 must be A and B in some order, and the first two in row 4 must be C and D in some order, and so on all the way down. Something like this (up to reordering of each pair):
A B * * * * *
C D * * * * *
A B * * * * *
C D * * * *
A B * * * * *
C D * * * * *
A B * * * * *
We can do the same starting from the right-hand side instead of the left. But so far the A's and B's outnumber the C's and D's, so let's balance that by swapping them on the right:
A B * * * C D
C D * * * A B
A B * * * C D
C D * * A B
A B * * * C D
C D * * * A B
A B * * * C D
Extending the same pattern inwards looks promising, but let's stop before the central column since we can't go beyond the hole there (and we need to consolidate the difference between AB and CD in a single row at some point):
A B A * D C D
C D C * B A B
A B A * D C D
C D C B A B
A B A * D C D
C D C * B A B
A B A * D C D
But now there are no viable possibilities for any of the cells in the central column: each one is next to an A, a B, a C, and a D. So we'll need to change some of the half-rows from ABA to BAB (or vice versa) or CDC to DCD (or vice versa). Bearing in mind that too many ABA's compared to BAB's will make the A's outnumber the B's, let's try filling the top half of the square with ABA's and CDC's (so that the top half of the central column can be B's and D's) while filling the bottom half with BAB's and DCD's (so that the bottom half of the central column can be A's and C's):
A B A * C D C
C D C * A B A
A B A * C D C
C D C B A B
B A B * D C D
D C D * B A B
B A B * D C D
At this point we have 10 A's, 11 B's, 11 C's, and 10 D's. So in the central column, we want the A's and D's to outnumber the B's and C's. The final answer is:
A B A D C D C
C D C B A B A
A B A D C D C
C D C B A B
B A B A D C D
D C D C B A B
B A B A D C D
... which we can easily check satisfies all the required conditions.