No, we can not use this law for gases. Because, gases are compressible and for compressible fluids, the use of this law will not be true. If we apply pressure to gas or compressible fluid, the fluid becomes compressed and the density of the fluid increases. So, we will not see the same pressure effect of this fluid on the other sides.