The detection of gravitational waves by the Laser Interferometer Gravitational-Wave Observatory opens a new era to use gravitational waves to test alternative theories of gravity. We investigate the polarizations of gravitational waves in $f(R)$ gravity and Horndeski theory, both containing scalar modes. These theories predict that in addition to the familiar $+$ and $times$ polarizations, there are transverse breathing and longitudinal polarizations excited by the massive scalar mode and the new polarization is a single mixed state. It would be very difficult to detect the longitudinal polarization by interferometers, while pulsar timing array may be the better tool to detect the longitudinal polarization.