How do slight changes in these properties result in a large change in pressure, microscopically?
Slight change of volume is not so easy to accomplish for solids - it takes a great force to achieve it. Considerable external force applied by different body (wall) needs to be maintained. The pressure is a measure of this force per unit area and since the force is great, also the pressure is great.
One way to explain this is the following. In solids, the atoms are so close to each other that the inter-atomic repulsion forces become close to comparable to intra-atomic forces between charged particles that constitute them.
The electric force between particles gets stronger at small distances, since the Coulomb law says it changes with distance of particles $r$ as $1/r^2$. To change the volume of a solid appreciably, the force per area associated with one atom would have to be comparable to the Coulomb electric force of the nucleus on the electron. Its value for atoms is so immense that it is unattainable by common standards. It would be also hard to find a container that would keep its shape and resist expansion under such great forces. Hence changes in volume by forces of common magnitude are commonly negligible.
I have studied on the internet that gases exert equal pressure in all directions in a container but liquids do not. [...] Why is that so?
Actually they both work in the same manner. The cause is the presence of gravity.
Pressure increases with depth in a liquid, because the heavy (dense) liquid has to carry the whole column of liquid above it. A water particle at the bottom of the sea must hold up all the water above it and all the air above that. The water particle at the surface only has to hold up the air above it (corresponds to standard atmospheric pressure).
It is the same thing for air and other gases. And as you might already know, the atmospheric pressure at ground level is much bigger than the atmospheric pressure at an air plane in a height of 10 km. Just watch any aircraft crash movie and see how everything is suched out when there is a breach because of the lower outside pressure...
For gas within an earth sized container, the pressure difference because of depth is so small because of the very low density that it simply doesn't have to be considered.
Also can there be a situation in which liquid can exert equal pressure on the walls of their container, independent of depth?
Yes, in outer space where no force like gravity pulls all particles in one single direction so they have to "carry" reach other. But in that case it would also be difficult to define depth...
I should mention though that such liquid in outer space of course exerts it's own gravitational pull. If you have large quantities of liquid (or gas for that matter - just look at a gas planet), and I mean very large quantities, then the liquid will form a sphere and the pressure will increase as you dive deeper. But this depth is then measured towards the center of this sphere.
Best Answer
You are right that if we only halved the number of particles we would have a smaller pressure. But you have also halved the volume of the container. The fewer number of particles hits the walls more frequently due to the smaller volume. In other words, the number of particles goes down, but the number of collisions per particle goes up. The two effects cancel out, leading to the same pressure as before you put in the partition.