Transistors are very sensitive to voltage spikes such as the ones generated by individual loads. Many types of transistors used in switching include internal protective diodes. But if they do not, it is recommended that you add them as shown in Figure 1.
The ideal components for this purpose are Schottky diodes, since these devices are fast enough to react to the short pulses generated by the dc motors. But, for common applications, your circuits can be protected by Common diodes such as the 1N4002 and others in that series.