First let us address "emty space".
Empty space is a theoretical concept, a space where there is no matter and no energy.
In our universe, no matter how far away one goes in space, it is not empty. It contains the cosmic microwave background radiation, cool photons, which is at a temperature of 2.7 K .
Within quantum mechanics and elementary paricles, the "empty space" , ignoring the CMB existence and assuming empty space exists, can be mathematically populated. What does this mean? A mathematical model exists where every elementary particle in this table populates "empty space" with the ground state of the solution for the field of that particle. This means that the existence of that particle, an electron on the way to the sun, for example, appears as an excited state on this ground state solution for electrons, and a probability distribution of its trajectory in space accompanies it, as the Heisenberg uncertainty principle , HUP
defines a region around the trajectory where the probability of finding the electron at x, constrains the probability of its momentum being p.
The quantum foam is an extension of this format, taking the HUP and examining a region of space for a tiny time interval delta(t) and saying then there must be a delta(E) for that energy.It then goes further, saying that the positron field also exists at that (x,y,z,t) and a "virtual" electron positron loop could be drawn existing for very small time with the energy allowed by the hup.
This is a misuse of the Feynman diagrams where such loops exist, misuse because in empty space no interactions are happening, and virtual particles are just lines in Feynman diagrams representing mathematical forms to be integrated over. A closed loop cannot be integrated over if the limits of the integral are (0,0). A real particle interaction is needed with real outgoing particles to be able to define intermediate virtual "particles", which have the name but not the mass of its name.
So the "quantum foam" picture is a handwaving hypothesis, based on the HUP, but really not calculable in any way so as to give anything measurable larger than zero in empty space. It is only within interactions that the effect of virtual loops is observed as measurable, as in the Casimir effect and the Lamb shift.