First, I've never heard of using a 24v trolling motor on a jon boat.
But I'm sure it will work, that's just a lot of weight for a jon boat.
You will be hooking up the depth finder to one battery. Red to positive, black to negative.
You would be hooking up the trolling motor to the pair of batteries in series.
Like this:
The problem with using a 24v trolling motor is if you drain both of your batteries with your trolling motor, you won't have any juice left to start your outboard engine(unless it's of the smaller pull-start variety).
Most people that use 24v trolling motors(big bass boats) actually use 3 batteries. 2 for the trolling motor and one for starting the outboard engine.