In the year 2408 after the Klingon and Gorn invade Cestus III a Starfleet Committee chaired by Admiral Jorel Quinn passed motion to explore other options and possibilities in order to build up the Federation with commanders and ships. "We need to promote exceptional officers quickly. We need our captains leading away teams. Starfleet needs to look at our whole command structure and do what works now, not what worked 30 years ago."
A Starfleet diplomat was sent back to the late 2260's to speak with Starfleet in order to round up several possible exceptional commander candidates and as many star ships as they could refurbish from the decommissioned roster. This section 31 operation was known as Projct Christopher after the 1960's aiforce officer that was beamed aboard the USS Enterprise.
In order to not affect the time continuum the only way to choose worthy captains out of their own time and bring them to the future is to find all those that have no future. The captains must be about to die and taken from circumstances seconds before they meet their demise. They now have to accept that they have no past but have been given a new future. These are members of the ghost fleet.
The chosen captains were given ships that were pre programmed with precise calculations in order to carry out the light-speed breakaway factor to artificially-created time warp in order to time travel back to the 2408.
Once the initial five captain were sent, Starfleet would keep their eye out for any such qualified command personnel to join the fleet and to help fight the war in the future.
You may be that commander!