When the number of items is small, as it is in your case, you can do this by bruteforcing all permutations in three nested loops:
Point3D[] a = new Point3D[4];
Point3D[] b = new Point3D[4];
for (int i = 0 ; i != 4 ; i++) {
for (int j = 0 ; j != 4 ; j++) {
if (j == i) continue;
for (int k = 0 ; k != 4 ; k++) {
int m = 6 - i - j - k;
if (k == i || k == j || m == i || m == j || m == k) continue;
var d = a[0].Distance(b[i]) +a[1].Distance(b[j]) + a[2].Distance(b[k]) + a[3].Distance(b[m]);
min = Math.Min(d, min);
}
}
}
This finds the minimum in 4! = 24 iterations. If you have more points than, say, more than ten, a much better algorithm is available - you can use the Hungerian algorithm to find the minimum-weight matching in polynomial time O(n3).