After sailors had crossed the Atlantic to the West Indies, they would take the native women on board the ship and have their way with them in between the cannons. Some of the women the sailors left behind would have boys, who were called sons between the guns.
Rob Flynn says: The phrase is actually 'burning the candle at both ends of the day' i.e. getting up early in the morning (and burning a candle) and going to bed late (and again burning a candle). Which is why we say that someone looking tired and haggard from overwork (or overplay) has been burning the candle at both ends...