In order to charge a detachable battery, you need a charger. Most chargers have a slot designed to hold the battery while it charges.
Some cordless impact drivers come with a charger included. However, if you have to purchase one, make sure you choose the correct charger for your battery.
It’s very important that you purchase a charger which is designed to charge your particular brand and voltage of battery.
For example, using an 18 volt charger to charge a 10.8 volt battery or using a brand X charger for a brand Y battery could potentially damage both the battery and the charger.