Understanding the Design of Common ULN2803a Motor Driverboards (use of the capacitor in particular)
The idea is to reduce external large current loops with dV/dt by re-directing the motor current in the same direction but from diode cap instead of U1. This also means less surge EMI from the battery wire  loop area. The dI/dt radiated noise increase with loop area. So having Cap and diode close to U1 keeps this loop small. 

It is assumed you can choose  Cap with lower ESR than the battery ESR and wire inductance at frequency equivalent to the decay rate of T=L/R = 0.35/f-3dB where R include motor, diode and cap or battery.

Using twisted pairs is useful to reduce interference for all current wire ( supply and return)







simulate this circuit &ndash; Schematic created using CircuitLab
The ceramic cap has much lower ESR than the battery or power supply after inductive wires.

The flyback energy is small but can still create interference with sensors as it supplies only the power last used ( motor current) for  xxx ns.

Depending on actual values of RLC for load, wire and circuit, it can still cause EMI problems if badly tuned. ( high Q MHz ringing)