Battery charger with reversible polarity
To answer your question, yes it is possible. The choice of exactly how to do this would depend on the specific battery involved and what other design constraints you face.