At least in the 2D case, this formula follows immediately from the definition of conditional probability, since we assume a uniform distribution over B and hence our PDFs are constant, so their integration yields a ratio of areas. In a 3D case, each ray can only enter the solid through a single face. So, focusing on the plane of the face of A parallel to the intersected fact of B, we see that the ray is again uniformly distributed within the area of B's face when it intersects the plane of A's face, so we get the ratio of face areas as in the 2d case. The surface area is the sum of the face areas, so it is not too hard to imagine that the total conditional probability across all faces will reduce to a ratio of the sums of the face areas, and hence a ratio of the surface areas.
At least in the 2D case, this formula follows immediately from the definition of conditional probability, since we assume a uniform distribution over B and hence our PDFs are constant, so their integration yields a ratio of areas. In a 3D case, each ray can only enter the solid through a single face. So, focusing on the plane of the face of A parallel to the intersected fact of B, we see that the ray is again uniformly distributed within the area of B's face when it intersects the plane of A's face, so we get the ratio of face areas as in the 2d case. The surface area is the sum of the face areas, so it is not too hard to imagine that the total conditional probability across all faces will reduce to a ratio of the sums of the face areas, and hence a ratio of the surface areas.