Compression occurs because of Newton's second and third laws.
The crux of the issue is what these laws really mean (and a little bit treating the sponge like a whole, single object). You know the laws, but we have to dig into them to make the answer clear.
Newton's second law:
The first problem is that this law is often abbreviated to "force equals mass times acceleration." It is critically important to note, however, that
$\overrightarrow{F} = m\overrightarrow{a}$
describes the net force acting on an object - the sum of forces on that object.
Newton's third law:
The second problem is that this law is given to us in terms of "actions" and "reactions," which are mathematically meaningless. Instead, think of actions and reactions as two halves of a pair of forces that always occur whenever anything happens.
Before you put the weight on the sponge...
...the net force on both objects is zero.
Both are subject to Earth's gravity. Both are sitting on the table (or whatever), which is, itself, pushing on the Earth, all equally pushing back on each other. Their net forces are all zero, therefore their accelerations are all zero. They aren't going anywhere.
As you put the weight on the sponge...
...the sponge moves.
You might be thinking, no it doesn't.
In Newtonian mechanics, we tend to treat objects such as sponges like whole, discrete things, and this is incredibly convenient. It is important to remember, however, that nothing is truly this way. Sponges, like everything else, are made of molecules.
So what's happening?
Zooming in, the molecules which constitute the sponge are in equilibrium with each other before the experiment as well. They are some natural distance from each other due to intermolecular, electromagnetic forces, which result from whatever property makes sponges the way they are. This is a rabbit hole of explanation beyond the scope of the question.
As the weight initially pushes down on the sponge, the sponge does push back with some force. However, the top layer of molecules also begins to accelerate. This is because the forces which keep the sponge's molecules that initial distance from each other are weaker than the forces experienced by the top layer of molecules.
In this moment, Newton's third law is not violated. The sponge is moving and simply isn't experiencing the full weight of the object compressing it.
We do know, however, that the force exerted by the sponge on the weight in return reduces the weight's net force and therefore reduces its acceleration.
Following through (keep this in mind when you get to the section about Hooke's Law):
As the sponge's molecules get more and more compressed, they also become less and less able to compress. This is to say that the magnitudes of the intermolecular electromagnetic forces become greater.
Eventually, these forces overcome the downward net force of the weight and it begins to slow down. During this time, the weight is still falling because it still has velocity. The force exerted by the sponge on the weight is momentarily greater than the weight of the object.
This phenomenon is the same reason that objects seem heavier when they are falling (e.g. it might be easy to hold a stack of books, but difficult to catch a stack of books).
The result is that the weight bounces upward. This effect will vary depending on whether or not you carefully place the weight down or drop it (how much kinetic energy the weight has).
Eventually...
...the molecules of the sponge will all be compressed according to the new sum of force acting on them (due to gravity on themselves, the weight of all the sponge molecules above them, and the object sitting on the sponge).
This new net force is once again zero, but each action/reaction pair of forces is greater in magnitude.
Making all of that easier with Hooke's Law:
In the 17th century, Robert Hooke simplified this whole process with a law which looks like
$F_s = kx$
where $F_s$ is the force required to deform a spring by length $x$.
$k$ is a value called the spring constant and is different for every type of spring-like object. This is the value one would use to take those aforementioned intermolecular electromagnetic forces and reduce them to a nice, easy constant. Someone else could then reference that value and predict the compression of a similar sponge in the future.
Does that answer your question?