Consider the transformation x' = ax
Consider how the metric transforms under this transformation (from t,x,y,z to t,x',y,z), and how the volume element tranforms under this transformation.
Hint:
A unit volume 4- cube has dt, dy, and dz the same, but dx' = a dx.
We can use the tensor transformation law to transform the metric, or just algebra. To use just algebra, we write the line element in terms of dx,dy,dz and we use again use the formula dx' = a dx.
So a line element of -dt^2 + dx^2 + dy^2 + dz^2 transforms into -dt^2 + dx'^2/a^2 + dy^2 + dz^2
This isn't a completely general derivation , but should (hopefully) give you a good intiutive feeling for questions like "where did that square root come from"