Part One: Habitable Planets and Planets with Native Intelligent Life are Very Common In the Star Trek Fictional Universe.
This part was added 09-24-2020 in response to comments by Paul D. Waite and by Polygnome.
The earliest and so far as I know only discussion about planets habitable for humans (and also for lifeforms with similar environmental requirements) specifically, and not just lifeforms similar to some Earth life forms, is Habitable Planets for Man Stephen H. Dole, 1964, 2007.
Dole estimates that only stars of spectral classes F2 thorugh K1 are likely to have planets habitable for humans, and estimates the probability that any specific star of each of those categories would have one habitable planet. In table 18, in page 104, he estimates the number of such stars within a specific volume of space, and combines that with the probability of having habitable planets, and finds that there should be 4.03 times ten to the minus 4th power stars with habitable planets within one cubic parsec of space. A cubic parsec is 34.695734 cubic light years.
It is a bit difficult to visualize a cubic parsec; therefore Table 19 is included to give the expected number of habitable planets that should be found within a spherical volume with radius R centered on the Sun.
Table 19 on page 105 shows that one habitable planet is expected within 27.2 light years of the Sun, two within 34.3 light years, 5 within 46.5 light years, 10 within 58.5 light years, and 50 within 100 light years.
On page 103 Dole says:
Since the galaxy has a volume of about 1.6 times 10 to the 12th power cubic parsecs, this means that the total number of habitable planets in the Galaxy is about 600 million.
That is about 1,600,000,000 cubic light years in the galaxy.
How many potentially life bearing planets are in the galaxy acccording to modern estimates?
In November 2013, astronomers reported, based on Kepler space mission data, that there could be as many as 40 billion Earth-sized planets orbiting in the habitable zones of Sun-like stars and red dwarfs in the Milky Way,5 11 billion of which may be orbiting Sun-like stars.3
Of course, Earth sized planets in the Habitable Zone do not necessarily have life on them, and those figures are probably the upper parts of ranges.
Using a clever method to detect Earth-size exoplanets they may have missed, astronomers calculated that 1 in 5 stars like the one at the center of the solar system hosts a planet capable of holding liquid water on its surface and — if it had the right chemical ingredients — supporting life.
The results suggest that the Milky Way is home to 11 billion Earth-like planets. If lukewarm planets orbiting cooler red dwarf stars are included, the total rises to 40 billion, Marcy said. The nearest could be just 12 light-years away.
If the 11 billion Earth size planets orbiting Sun like stars orbit stars from spectral classes F2 to K1, as in Dole's estimate, then if one out of every ten has life there would be 1,100,000,000 planets with life, and if one out of every ten of them was habitable for humans that would make 110,000,000 planets habitable for humans orbiting stars of those spectral types, about 0.1833 of Dole's estimate.
If there are 29,000,000,000 Earth size planets orbiting in the habitable zones of red dwarf stars, and one out of ten has life that is 2,900,000,000 planets with life, and if one out of ten of them is habitable for humans that makes 290,000,000 more planets habitable for humans.
But in the fictional universe of Star Trek, habitable planets seem to be many times more common than such scientific estimates suggest. A number of habitable planets orbit stars which are considered totally unsuited to have naturally habitable planets, suggesting that highly advanced civilizations terraformed those planets sometime in the past. If those highly advanced ciivlizations have terraformed a major percentage of planets in the galaxy, there could be tens or hundreds of times as many habitable planets in Star Trek as scientists estimate.
The planet Vulcan is generally believed to orbit 40 Eridani A, though that is not canon. In Enterprise "Home", on the planet Vulcan:
TUCKER: You're sorry. You brought me sixteen light years just to watch you get married to someone you barely know.
And in Enteprise "Daedalus":
EMORY: Sub-quantum teleportation. You step on to a transporter on Earth, a few seconds later, you're on Vulcan.
TUCKER: That's over sixteen light years.
So Vulcan is between sixteen and seventeen light years from Earth. A sphere with a radius of 17 light years has a volume of 20,579.53 cubic light years and a sphere with a radius of 16 light years has a vulume of 17,157.28 cubic light years. So the spherical hollow shell of space between 16 and 17 light years from Earth contains 3,422.25 Cubic light years and would contain about 13.689 stars on average.
Actually there are 16 known stars and brown dwarfts, in 12 systems, within that hollow shell of space. One of them is 40 Eridani. And another is Altair.
In "Amok Time" there is a conflict between going to Vulcan and going to Altair VI to attend the inauguration of a new president:
KOMACK [on monitor]: Altair Six is no ordinary matter. That area is just putting itself together after a long interplanetary conflict. This inauguration will stabilise the entire Altair system. Our appearance there is a demonstration of friendship and strength which will cause ripples clear to the Klingon Empire.
So there are at least two systems with native intelligent life within that shell of space. That implies 1 planet with intelligent life per 1,711.125 cubic light years, or about 935,057,345.3 planets with intelligent life in the galaxy.
And in "And the Children Shall Lead":
KIRK: Yes, Doctor. Spock what do we know about the race that lived here?
SPOCK: According to the legend, Triacus was the seat of a band of marauders who made constant war throughout the system of Epsilon Indi. After many centuries, the destroyers were themselves destroyed by those they had preyed upon.
This implies there has been at least one native intelligent species on planets in the Epsilson Indi system. Epsilon Indi is about 11.87 light years from Earth.
In "Spock's Brain" they track a spaceship to the Sigma Draconis system:
CHEKOV: Sun, spectral type, Gamma nine. Nine planets, three of them, Class M possessing sapient life according to reports and long-range scanning.
Sigma draconis is about 18.77 lightyears from Earth.
So in a sphere with a radius of less than 20 light years, and a volume less than 33,510.32 cubic light years, which would contain 134.04 stars on the average, there are at least seven planets with native inteelligent beings in at least five star systems, implying that in Star Trek about 0.03 of all star systems have at least one native intelligent species.
This implies that there is at least one planet with native intelligent life per 4,787.1885 cubic light years, and thus about 334,225,401.8 planets with native intelligent life the galaxy.
Part Two: The Cubic Volume of Space, and the Number of Stars in it, Increases Rapidly With Diameter.
I can quote from my post number 27 on a thread in a different site:
Suppose that there is a map of the galaxy on your computer screen which shows the entire galactic disc, which is about 100,000 light years in diameter, from "above". Suppose that the United Federation of Planets is large enough to appear as an area on that galactic map instead of as a mere dot with no visible dimension.
Suppose that the Federation has a one star admiral in charge of the defense forces in every group of 10 star systems, a two star admiral in charge of the defenses of every 100 star systems, and a three star admiral in charge of the defenses of every 1,000 stars systems.
If the Federation had two three star admirals under one four star admiral in charge of all system defense forces, the Federation would rule about 2,000 star systems. Surely that is a vast number of star systems and would make the Federation cover a significant area on galactic maps.
With the stellar density in the region near Earth, a spherical volume of space with a radius of 50 light years and a diameter of 100 light years would contain about 2,096 star systems. A sphere with a diameter of 100 light years would spread across one thousandth of the diameter of the Milky Way Galaxy and would look very small and unimportant in a map of the galaxy.
Suppose that the Federation rules about 2,096,000 stars in a spherical volume about 1,000 light years in diameter.
If the Federation has a one star admiral in charge of the defense forces in every group of 10 star systems, a two star admiral in charge of the defenses of every 100 star systems, a three star admiral in charge of the defenses of every 1,000 stars systems, a four star admiral in charge of the defenses of every 10,000 star systems, a five star admiral in charge of the defenses of every 100,000 star systems, and a six star admiral in charge of the defenses of every 1,000,000 star systems, it would have two six star admirals under a seven star admiral in charge of all system defense forces in its 2,096,000 star systems.
Suppose that in the Federation, one star system out of every 10 to 100 had a highly advanced and industrialized Federation planet.
In that case, a Federation 100 light years in diameter would have between 20 and 200 such planets. If each advanced and industrialized Federation planet could build between 10 and 100 major space ships for Starfleet each year, and provide a crew for them, the Federation could produce and crew between 200 and 20,000 major starfleet ships each year.
In that case a Federation 1,000 light years in diameter would have between 20,096 and 200,960 such planets. If each advanced and industrialized Federation planet could build between 10 and 100 major space ships for Starfleet each year, and provide a crew for them, the Federation could produce and crew between 200,960 and 20,096,000 major starfleet ships each year.
So any major space battle between major galactic powers, like the Federation and the Dominion were said to be, is likely to involve fleets of tens and hundreds of thousand of space battleships, and quite possibly millions of space battleships.
So the difference between 40 starships being a big deal and 1,000 starships being a normal sized battle fleet is not nearly as vast as the difference between even the numbers of starships seen in the Dominion War and the number of starships a major galactic power which is depicted spread out over a significant part of the galaxy in various star maps should have.
Part Three: Travel Time Across the Federation:
Now I should quote from a few episodes:
TNG "Where No One Has Gone Before" after the Enterprise hurls though space at a vast speed:
PICARD: Position, Mister La Forge.
LAFORGE: Well, sir, according to these calculations, we've not only left our own galaxy, but passed through two others, ending up on the far side of Triangulum. The galaxy known as M Thirty Three.
PICARD: That's not possible. Data, what distance have we travelled?
DATA: Two million seven hundred thousand light years.
PICARD: I can't accept that.
DATA: You must, sir. Our comparisons show it to be completely accurate.
LAFORGE: And I calculate that at maximum warp, sir it would take over three hundred years to get home.
If if it takes at least 300 years to travel 2,700,000 light years at maximum warp, maximum warp should be less than 9,000 times the speed of light. That is still several times faster than later episodes indicate. Presumably a starship can travel faster in intergalactic space than in interstellar space, possibly because of the lower density of matter.
In TNG "Q Who?" Q takes the Enterprise far from their previous positon:
DATA: According to these coordinates, we have travelled seven thousand light years
DATA [OC]: And are located near the system J two five.
RIKER: Travel time to the nearest starbase?
DATA [OC]: At maximum warp, in two years, seven months, three days, eighteen hours we would reach Starbase one eight five.
So if Starbase 185 and the previous position of the Enterprise were equally far from system J 25, the maximum speed of the Enterprise would be about 1,947.74 times the speed of light.
But if Starbase 185 was only about 2/3 or something as far from system J 25 as the original position of the Enterprise was, the speed of the Enterprise would be closer to its speed in other episodes.
TNG "The Price":
DATA: The data from the Barzan's probe of the wormhole are quite impressive, Captain. The wormhole delivered the probe beyond the Denkiri Arm, in the Gamma Quadrant.
PICARD: It would take nearly a century at warp nine to cover that distance.
DATA: The same distance could be achieved in a matter of seconds through the wormhole.
On the other side of the Wormhole:
LAFORGE: Damn it, Arridor, we're seventy thousand light years away from our ships. Come on, now. Follow us in. We'll lead you.
WORF: Captain, DaiMon Goss is demanding to know where his men are.
PICARD: Advise him to set his coordinates for the Delta Quadrant. He may run into them in eighty years or so.
So warp nine on the TNG scale seems to be about 875 times the speed of light if it takes 80 years to travel.
At 875 times the speed of light it would take 0.114 years or 41.7 days to travel 100 lightyears, and 1.142 years or 417.4 days to travel 1,000 light years at warp nine.
But if 70,000 light years takes 50 to 100 years to travel at warp nine, warp nine would be about 700 to 1,400 times the speed of light. Thus it would take 0.07 to 0.14 years to travel 100 light years and 0.71 to 1.42 years to travel 1,000 light years at TNG scale warp nine.
In the DS9 episode "Fascination":
JAKE: Mardah's gone, Dad. She got accepted to the Science Academy on Regulus Three.
SISKO: That's a good school.
JAKE: It's three hundred light years away.
So if Bajor and the Bajoran wormhole are 300 light years from Regulus, they can be no more than a few hundred light years from Earth.
In DS9 "Emissary" they first discover and cross through the Bajoran wormhole:
DAX: There is a star just under five light years away. No M-class planets Computer, identify closest star system.
COMPUTER: Idran, a ternary system consisting of twin O-type companions.
SISKO: Idran? That can't be right.
DAX: Computer, basis of identification.
COMPUTER: Idran is based on the analysis conducted in the twenty-second century by the Quadros-One probe of the Gamma Quadrant.
SISKO: The Gamma Quadrant? Seventy thousand light years from Bajor? I'd say we just found our way into a wormhole.
And in "Battle Lines":
BASHIR: There's Idran, the closest system. It's a ternary star.
OPAKA: A doorway into the unknown.
SISKO: The other side of the galaxy, to be precise. The Gamma quadrant is seventy thousand light years from Bajor. It would take our fastest starship over sixty seven years to get here.
So if the distance is exactly 70,000 light years and the travel time is exactly 67.5 years, the speed of the fastest starship at that time would be about 1,037.037 times the sped of light.
At that speed it would take 0.096 years or 35.220 days to travel 100 light years and 0.964 years or 352.2 days to travel 1,000 light years.
In the Voyager pilot episode "Caretaker" Voyager stops at DS9 in the Bajoran system, then heads for a region of space called "the Badlands", mentioned as being close to Bajor in several episodes.
Voyager is described:
STADI: Intrepid class. Sustainable cruise velocity of warp factor nine point nine seven five. Fifteen decks. Crew complement of one hundred and forty one. Bio-neural circuitry.
In the Badlands, Voyager is transported to the Caretaker's array:
KIM: Captain, if these sensors are working, we're over seventy thousand light years from where we were. We're on the other side of the galaxy.
JANEWAY: You've taken us seventy thousand light years from our home. We have no way back unless you send us, and we won't leave without the others.
JANEWAY: We're alone in an uncharted part of the galaxy....But our primary goal is clear. Even at maximum speeds, it would take seventy five years to reach the Federation, but I'm not willing to settle for that...
So travelling exactly 70,000 light years for exactly 75 years would be require a speed of exactly 933.333 times the speed of light. At that speed Voyager could travel 100 light years in 0.107 years or 39.134 days, and 1,000 light years in 1.071 years or 391.34 days.
So how large is the Federation and/or the volume of space where starships operate and explore?
In TNG "The Icarus Factor" the Enterprise is at Starbase Montgomery:
PICARD: Number One, I've just been recollecting the arrival of a new First Officer on board the Enterprise, and a manual docking confidently achieved. I may have been somewhat miserly in my congratulations then, so let me make up for it now. The Captain of the Starship Ares is retiring. Congratulations. You've been selected as his replacement.
RIKER: The Ares. She's in Vega-Omicron sector.
PICARD: And they have picked up indications of an intelligent life form, though nothing confirmed.
RIKER: Obviously, Starfleet will want to know more.
PICARD: That's why they're asking for you. Not for your military proficiency, but for your skill as an explorer and as a diplomat.
RIKER: Vega-Omicron. It'll take months at high warp just to get there.
In Star Trek: First Contact:
LILY: How many planets are in this Federation?
PICARD: Over one hundred and fifty ...spread across eight thousand light years.
One hundred and fifty planets spread out over a diameter of eight thousand light years would be spread extremely thinly. One hundred and fifty habitable planets within a volume of eight thousand cubic light years would be extremely densely concentrated. So it is hard to made sense of Picard's statement.
But if the Federation, and/or the volume of space where starships operate and explore, is hundreds of light years wide it will take months to cross it, if it is thousands of light years wide it will take years to cross it.
So in "The Best of Both Worlds" the Federation could only assemble 40 starships in time to intercept the Borg cube headed for Earth.
But the Dominion was revealed as a large and potentially dangerous power years before the Dominion War began. So the Federation had time to move more and more starships toward the Bajoran mouth of the wormhole leading to the Gamma Quadrant and maybe start building starships faster. And the Federation might have had a large fleet of mothballed starships which may have been quickly readied for combat before and during the war.
And possibly the Federation mobilized many Starfleet reservists to man the mothballed starships. In Star Trek: The Motion Picture:
KIRK: That has a familiar ring, doesn't it? Starfleet, this is Captain Kirk. Beam that officer up now! ...Well, for a man who swore he'd never return to Starfleet.
McCOY: Just a moment, Captain, sir. I'll explain what happened. Your revered Admiral Nogura invoked a little known, and seldom used, reserve activation clause, ...in simpler language, Captain, they drafted me!
And I repeat that the numbers of ships reported in major space battles during the Dominion War are extremely minute and tiny compared to the vast numbers of space battleships that major powers in the galaxy should have.
The difference in scale between Wolf 359 and the Dominion War battles is tiny compared to the difference in scale between the Dominion War battles and the vast scale of the space battles which should have been fought if the Federation and the Dominion were the big time galactic powers they were often described as.