I would rig up a matching female receptacle into which the trailer male plug will connect and wire it to my battery charger output with the appropriate pin connectors (see diagrams blow). Of course, the trailer wiring has to have the hot 12 VDC power lead connected to the trailer battery and ground proper pins. Then all you have to do is plug the charger into the trailer via the connectors and you're off to the races.
NOTE the standard (see below) 7 pole RV plug and connector wiring and appropriate pins is what I use and recommend. It has one pin for the 12 VDC power use.
Similar when I'm driving my RV engine alternator charges the battery in my trailer or toad via the 7 pole RV plug and connector. I have that wiring protected by circuit breakers at BOTH the RV and trailer or toad. A person can even add a diode so current can ONLY flow from RV to toad/trailer but NOT reverse.
A small 12 volt solar panel is another way to maintain and trickle charge a battery on a trailer that sees little use provided its outdoors. Alternatively a battery trickle maintainer can be used to power the unit.