The thermodynamic properties of the ferromagnetic perovskite YTiO$_3$ are investigated by thermal expansion, magnetostriction, specific heat, and magnetization measurements. The low-temperature spin-wave contribution to the specific heat, as well as an Arrott plot of the magnetization in the vicinity of the Curie temperature $T_Csimeq27$ K, are consistent with a three-dimensional Heisenberg model of ferromagnetism. However, a magnetic contribution to the thermal expansion persists well above $T_C$, which contrasts with typical three-dimensional Heisenberg ferromagnets, as shown by a comparison with the corresponding model system EuS. The pressure dependences of $T_C$ and of the spontaneous moment $M_s$ are extracted using thermodynamic relationships. They indicate that ferromagnetism is strengthened by uniaxial pressures $mathbf{p}parallel mathbf{a}$ and is weakened by uniaxial pressures $mathbf{p}parallel mathbf{b},mathbf{c}$ and hydrostatic pressure. Our results show that the distortion along the $a$- and $b$-axes is further increased by the magnetic transition, confirming that ferromagnetism is favored by a large GdFeO$_3$-type distortion. The c-axis results however do not fit into this simple picture, which may be explained by an additional magnetoelastic effect, possibly related to a Jahn-Teller distortion.