Is it safe to use a voltage divider for Arduino and DC motor controller?
Using a voltage divider as a power source for almost anything is a Very Bad Idea.  The actual voltage supplied to the load will vary with the load current.  I expect that the current drawn by an Arduino will be Much, Much Greater than is drawn by your 10 meg resistor, so the voltage will be much less than you expect.

You should use a DC-DC converter (AKA switching regulator) to drop the 12 volts down to 5 for the logic.  A linear regulator such as the LM7805 could also be used, if the 5 volt current demand is low, but a linear regulator will waste the excess power as heat.