Is there a way to periodically change the circuit a power supply is connected to?
What I'm trying to do is I want the power supply to be connected to a battery charging circuit at night and then in the morning I want the power supply to be connected to the motor driver.


Yes. There's nothing particularly difficult about this. You just need a microcontroller, a way for it to keep track of whether it's day or night, and a switching device that it can control.


  Would a relay be able to do this?


Yes. You might prefer to use a latching relay rather than one that needs its coil constantly driven to maintain a certain state. Or you might prefer a non-latching relay, depending on your full system requirements.

Depending on the amount of current being switched, and the voltage, it might be cheaper to use some MOSFETs or a solid-state relay (SSR) instead of an electromechanical relay.