To make it easier to imagine, rotate the whole picture py $45^\circ$. Then you still consider midle point, but the lines considered has to be either vertical or horizontal.
Let $t_i$ and $s_i$ be coordinates of points in a rotated coordinate system. Up to a scale factor of $\frac{1}{\sqrt{2}}$ which can be omitted for an optimization problem, you have
$$ t_i = x_i+y_i, \qquad s_i = y_i-x_i$$
In theese coordinates, you have $x_{ij} =\frac12\min\{|t_i-t_j|,|s_i-s_j|\}$ and you're looking for a pair of points for which it is minimal. You can do it by first finding a pair of point for which $|t_i-t_j|$ is minimal and another pair for which $|s_i-s_j|$ is minimal; then comparate the two and choose the better pair.
To find the minimal $|t_i-t_j|$, let us sort the points such that $t_1\le t_2\le\dots\le t_n$. It is obivious that the minimal $|t_i-t_j|$ will happen for some pair of subsequent points, meaning
$$ \min_{ij} |t_i-t_j| = \min_i |t_{i+1}-t_i| $$
So you don't need to check every pair of points, only the points ordered one after another.
You do an analogously thing to find $\min_{ij} |s_i-s_j|$ (probably, you'll need to sort the points again).
As I've said before, you have then $x_{ij} = \min\{\min_{ij} |t_i-t_j|, \min_{ij} |s_i-s_j|\}$, and you just need to recall what were the points that gave you this minimal value.
The perpendicular line has the property that its every point is in equal distance from the two original ponits. But the distance from the original points to the line don't have to be calculated to the same p[oint of the line.
– Adam Latosiński May 08 '19 at 16:36