You're only assuming US sales. It's a big world. Within the past year or so, they got the contract to supply the UK military.
Actually, I put more into consideration than you think.
Military contacts do not come all the time. They come and go. Even if there is a purchase program there is no guarantee a particular company will get the contract.
U.S. Military is far lager than that of UK, but do you think Beretta will survive just by catering to U.S. miliary? I think they did just that, and look at where they are now.
Even if I assume only 1/3 of US population buys guns, that is over 100 million. I do not think all the active duty soldiers in top 100 strongest country, military wise, put together will still top that. Of course, not all of them buys pistols, but then again, not all soldiers are issued pistols either. UK forces have about 205000 active personnel, but only buying 25000 pistols. Also, consider that many pistol buying U.S. civilian buys more than one. Even significant number of cops buy their own guns, lot of them by choice when ther are issued a pistol.
Also, to put things into proper perspective, global military and police market is not free competition. China has far more number of soldiers than us or even Russia, but I do not see China's military buying anything other than what is made in China anytime soon. Not only there is a national pride issue to nationalistic countries, there is also an interest to protect domestic defense industry. It's the same reason why you won't see Italian army usning any rifle other than ones with Beretta logo on it any time soon. Police wise, many countries have different culture and concept of policing compared to U.S. Most street cops in Japan do not carry pistols. A lot of countries are content with worn out handed down guns, not because it performs well, but their administration are stupid.
Look at pistols like HK45, Mk23 etc. Huge investment for R&D, aimed for government sales, but very limited adoption in the end. Companies like H&K would have been far more hesitant if they could not count on civilian sales. Probably American civilians bought more HK45c than NAVY SEAL did.