Sensing and responding to mechanical cues in the environment are important for the survival and propagation of bacteria. A "social" bacterium, Myxococcus xanthus, which exhibits periodic cell reversals, modulates its reversal frequency in response to environmental mechanical cues, such as substrate stiffness and cell-cell contact. The cell-cell contact-dependent reversal control is particularly important for formation of complex multicellular patterns and structures during cooperative "social" behaviors in M. xanthus populations. Here we hypothesize that the gliding motility machinery of M. xanthus can sense the environmental mechanical cues during force generation and signal the cell's reversal control pathway to modulate the timing and frequency of cell reversal. To examine our hypothesis, we extend an existing mathematical model for periodic polarity switching (which mediates periodic cell reversal) in M. xanthus, and incorporate the experimentally suggested (i) intracellular dynamics of the gliding motors and (ii) interactions between the gliding motors and reversal regulators. The model results suggest the proper mode of interactions between the gliding motors and reversal regulators that can generate the observed increase of cell reversal frequency on stiffer substrates. Furthermore, the selected model predicts a cell reversal response to cell-cell contact, which is sufficient for generating the rippling wave, an important multicellular pattern in M. xanthus populations. Our model highlights a potential role of the gliding machinery of M. xanthus as a "mechanosensor" that transduces mechanical cues into a reversal control signal.