LM317 - Caps necessary on 9v Battery?
According to the datasheet (p10) the input capacitor is recommended (I would translate that as required) when the chip is not near the rectifier/filter-capacitor. You don't have a filter capacitor, and a 9V battery has a relatively high impedance, so I strongly suggest you include the 100nF input capacitor.

Again, according to the datasheet, the output capacitor is not needed but will improve the transient response. You motor won't care, so I'd leave that one out. (But it won't harm to leave it in.)