If it is assumed that for the universe: -
i. Space-time may be cut into hyper-surfaces (metrics h(ij)) of constant time, which are homogeneous and isotropic.
ii. the mean-rest frames of the galaxies agree with the definition of simultaneity.
Co-moving coordinates may be adopted in which each galaxy has no random velocity but has a fixed set of coordinates x(i), 1, 2, 3, ... With the time coordinates, the proper time for each galaxy will be found from the time-dependent metric coefficients. Thus, if at one moment, t0 the hyper-surface of constant time has a line element
dl²(t0) =h(ij)(t0)dx(i)dx(j)
(The brackets contain the coefficients). The expansion hyper-surfaces can be represented as follows: -
dl²(t1) =f(t1, t0).h(ij)(t0)dx(i)dx(j)
........ =h(ij)(t1)dx(i)dx(j)
It is assumed that the h(ij)'s expand at the same rate to maintain isotropic expansion. In general this equation, in terms of the overall scale factor R, is: -
dl²(t) =R².h(ij)(t0)dx(i)dx(j)
By constraining the requirement for homogeneity and isotropy, places R = constant = k. It is, thus, possible to derive the Robertson-Walker metric for cosmological space-time, namely: -
ds² = -dt² + R²(t).((dr²/(1 - kr²)) + r².dΩ)
In this metric k may take values 1, 0, -1 and give rise to: closed or spherical, Euclidean, and or hyperbolic or open space-time respectively.
If the universe is filled with a perfect fluid ρ = ρ(t), p = p(t). If the stress-energy tensor T(μν;ν) = 0, then due to spacial homogeneity, only the time component will be non-trivial and it is possible to show: -
d(ρR³) = -pd(R³)
__ .......... __
dt ........... dt
where R(t) is the cosmological expansion factor. Here R³ is proportional to the volume of any fluid element. Thus, the LHS of the equation is the rate of energy total change, whilst the RHS is the work done -pdV whilst it expands.
In the current 'matter dominated' era p=0, thus, the equation becomes : -
d(ρR³) = 0
__
dt
In the early radiation dominated era, the main energy density is that of radiation of relativistic particles (equation p = ⅓p), thus, the equation becomes: -
d(ρR³) = -⅓pd(R³)
__ ............ __
dt ............. dt
Thus, to answer your question - within this idealised model - galaxies do not collide and pressure is only significant during the radiation dominated era of the universe. The density is a measure of the cosmological scale factor (see above argument).
I hope this helps!!