  Magnetostriction and thermal expansion of the spin-ladder compound
piperidinium copper bromide (C$_5$H$_{12}$N)$_2$CuBr$_4$ are analyzed in
detail. We find perfect agreement between experiments and the theory of a
two-leg spin ladder Hamiltonian for more than a decade in temperature and in a
wide range of magnetic fields. Relating the magnetostriction along different
crystallographic directions to two static spin-spin correlation functions,
which we compute with Quantum Monte Carlo, allows us to reconstruct the
magnetoelastic couplings of (C$_5$H$_{12}$N)$_2$CuBr$_4$. We especially focus
on the quantum critical behavior near the two critical magnetic fields $H_{c1}$
and $H_{c2}$, which is characterized by strong singularities rooted in the low
dimensionality of the critical spin-system. Extending our discussion in Lorenz
et al [Phys. Rev. Lett., 100, 067208 (2008)], we show explicitly that the
thermal expansion near the upper critical field $H_{c2}$ is quantitatively
described by a parameter-free theory of one-dimensional, non-relativistic
Fermions. We also point out that there exists a singular quantum critical
correction to the elastic moduli. This correction is proportional to the
magnetic susceptibility $\chi$ which diverges as $\chi \sim 1/\sqrt{T}$ at the
critical fields and thus leads to a strong softening of the crystal.
