Gravitational waves (GWs) provide a new tool to probe the nature of dark energy (DE) and the fundamental properties of gravity. We review the different ways in which GWs can be used to test gravity and models for late-time cosmic acceleration. Lagrangian-based gravitational theories beyond general relativity (GR) are classified into those breaking fundamental assumptions, containing additional fields and massive graviton(s). In addition to Lagrangian based theories we present the effective theory of DE and the µ-Σ parametrization as general descriptions of cosmological gravity. Multi-messenger GW detections can be used to measure the cosmological expansion (standard sirens), providing an independent test of the DE equation of state and measuring the Hubble parameter. Several key tests of gravity involve the cosmological propagation of GWs, including anomalous GW speed, massive graviton excitations, Lorentz violating dispersion relation, modified GW luminosity distance and additional polarizations, which may also induce GW oscillations. We summarize present constraints and their impact on DE models, including those arising from the binary neutron star merger GW170817. Upgrades of LIGO-Virgo detectors to design sensitivity and the next generation facilities such as LISA or Einstein Telescope will significantly improve these constraints in the next two decades.