Liquids:
We know pressure is given by force per unit area, since liquid has weight in it therefore liquid exert pressure on the bottom of the container as well as the side walls of the container depending upon the amount of water above the observation point.
Gases.
According to the kinetic energy theory of the molecules of the gas particle, gas molecules move with some finite kinetic energy and collide to the walls of the containers and exert the pressure on the walls.