Who connected the fluid equation to cosmology? When did that happen? Are there any articles giving a history of the fluid equation as it appears in cosmology?
A simple answer is that the fluid equation comes from the Friedmann equations (which were derived ~1920's). By differentiating the Friedmann equation, and then substituting the acceleration equation into this form, we find an expression that tells us how the density of the universe changes with time, or the fluid equation.
A good resource that goes into more depth is an "Introduction to Cosmology" by Barbara Ryden.