In my settings, humans live in a world where the planet reacts violently to environmental pollution. Once it's reached a certain point, monsters erupt from the planet and attack all human beings. These monsters have a very hard chitinous shell which makes fighting them difficult. Armor piercing rounds work well but over time, the pollution from lead seeping into the water and soil triggers the planet into releasing stronger, hardier creatures. To counteract this, humanity phases out bullets and now uses simple iron nails/needles shot out from railguns, because it's less environmentally dangerous to recycle iron (which is fairly abundant in this world) but also because the needles can pierce through the monsters armor without issue. How valid is this reasoning?
Err ... No
You don't actually need to make bullets from lead. Copper or a copper alloy is one solution if you want an expanding round. But since you are battling armored creatures and armor piercing rounds are desired you have even more options principally steel, tungsten and if you can get it depleted uranium (assuming natural deposits of uranium are available and 'tolerated by the creatures, perhaps even nickel. Any dense metal (or more accurately any alloy of these metals) could be used mold a bullet and would do in a pinch, although if rail guns are the weapon of choice they will all need need a steel or iron core. The cheapest and simplest would however be plain old steel since its rail guns we're talking about albeit I'm not an engineer and I have no idea about any potential barrel wear/ballistic issues.
The point is that generally bullets will have better ballistic performance over longer ranges than 'needle' rounds will because of the different ratios of length to width and the impact of air resistance. With one big assumption: the railguns have to impart 'spin' on the bullet as it leaves the rail or barrel. Spin is what stabilizes a bullet and dives it accuracy at distance. You could also do something similar with needles (more properly called flechettes) if they had 'winglets' or tails designed to impart spin or were otherwise made to spin by the railgun. I still believe however (and someone more knowledgeable can correct me) that in comparison a bullet will have longer range and better accuracy at longer range than a flechette would. So IMO - stick with bullets.
Is lead poisonous to a planet?
It is a planet! Where did the lead come from, anyway? Probably somewhere in the planet. Lead is a natural substance. Good old lead. A planet with iron will have lead too.
You need your humans to wake up the monsters with industrial waste and weird chemicals as is the done thing. Then when the monsters prove to be tough, fight them with war gases and purposefully poisonous chemical creations - stuff that is seriously unnatural.
Then the big monsters come and the humans figure out what is up. Railgun needles are fine but I think these chemically inclined humans would probably start trying to figure out how to do a root canal on the planet, leaving the body intact but extirpating the power that is giving rise to monsters. Maybe buckyballs full of charged antimatter? Something like that would do. Or would it...
Depends on the biology of your monster. Needle guns aren't very effective against humans because bullets do tremendous damage because of the large exit and entrance holes, blood loss or by getting stuck in the body. A needle gun would do none of these things. Unless there is something about the biology of the monster that makes them particularly weak to needle size projectile then n your better off using conventional weapons.
This is a Frame Challenge
Stories serve two fundamental purposes: to educate and to entertain. The best stories do both. Why is this important?
Because I ran a micro-publisher for about ten years. I've read (literally) more than 10,000 manuscript submissions. I apologize that this might sound offensive, but very few ideas were more tiresome to read about than the environmentally-evil-humans stories. Why? Because most authors couldn't tell an interesting story because they were too busy grinding their axe. And if you'll forgive the pun, it poisoned their writing.
You're trying too hard
It isn't wrong that you're looking for a way to rationalize humanity switching from bullets to needles. What is wrong is that you're trying so hard to crowbar the idea of environmental pollution as the rationalization. What, after all, is pollution?
This is an important question. It's like art. We all "know it when we see it," but most of us would have a Dickens of a time defining it. What looks aesthetically pleasing to one person wouldn't make an acceptable paperweight to another. If humanity magically disappeared from the face of the Earth right now, the Earth would recover just fine from whatever we've done to it — and it would go on polluting itself through volcanism, wildfires, disease, and pestilence without any help at all from us.
From the simple flatulence of cows to the destructive dumping of toxic chemical byproducts into rivers and beyond, pollution (aka "environmentally-evil-humans") is very much a matter of opinion and equally as much in the eye of the beholder.
There's nothing wrong with Mother Earth attacking humanity for being bad stewards... except for one thing...
We're the product of Mother Earth just like everything else.
You can't say humanity is bad unless you're prepared to say Red Algae is bad. After all, so-called Red Tides (which aren't caused solely by Red Algae, but I'm making a point) bloom around the planet every year killing fish. Tomay-to, tomah-to.
If an algae bloom isn't evil for killing fish, why are humans evil for killing spotted owls? Here's where the "I don't know what art is, but I know it when I see it" part comes in. For some reason, despite millennia of experience proving the contrary, most of us think humans are supposed to know better.
Except that it isn't Mother Nature who's making that judgement. Mother Nature wouldn't know if we're supposed to know better or not if the idea bit her on the butt. It's we humans who make the judgement. We're the ones defining our own evil.
Except in your story
And that's the basis of my frame challenge. What's pollution from Mother Earth's perspective? I've personally picked up a lump of naturally-occurring lead the size of my fist. When I put it down again, did I pollute? We all agree that too much lead is harmful to life. OK, fine. Was that naturally-occurring lump harmful to life? I once lived in Idaho's Silver Valley at a time when EPA remediation from bad mining practices was occurring. They forced us to let them dig up our lawn and 18" of dirt and replace it with "clean dirt" because the percentages of lead and arsenic were too high. Too high for what? Our lawn wasn't littered with dead gophers (quite the contrary, it was filled with the holes dug by very alive gophers) and we never once saw a deer mindlessly butting its head against a tree due to lead poisoning.
Mother Earth has volcanoes and forest fires, toxic algae blooms and disease. She pollutes quite well herself, thankyouverymuch, and distinguishing between "natural pollution" and "man-made (can I say that anymore?) pollution" when humanity is as much a part of nature as every other aspect of life on this planet is a lot more difficult than it might seem.
Which is why it feels like you're crowbaring the idea of bullets creating more monsters thanks to the pollution they make (and so we need to use needles...). What is "pollution" such that Mother Earth would make monsters? Will she make monsters if a wildfire starts? If humans overeat, causing extra flatulence, is that pollution?
I know it when I see it... but what is it?
Until that's understood, no, I do not think environmental concerns could be valid reasons for using needles rather than bullets.
Beyond the Obvious
Railguns, are not the obvious choice, but many people forget that guns were not the obvious choice either. For most of human history the bow, that is the war bow, was superior to the gun in every possible way. They could fire faster, were more accurate, and never blowup in your face. In fact, why have guns at all. They were cheap and easy to use. Then, they became incredible.
I am saying a similar cycle would occur with railguns. They first ones will be crap, but the first gun was just an iron pipe with a few hole. They got better and better. Now, it is the age of the railgun. The proto-types will suck, but the drive towards this one goal will accelerate the process of improvement to the point where soon enough, the will be effective. Later, they may even become better than the guns that came before.
Of course there is always more than one possible possibility.
You have humans living on an alien planet. This means they're capable of space travel which means they're capable of asteroid mining which means gold isn't as rare as it use to be.
Gold is an inert metal that is denser than lead and works really well in regular guns and regular ammunition. The only reason it's not used is the value of gold.
Rail guns are all nice and such but they are far more bulky, heavy and complicated than the simple rifle that has barely changed hundreds of years.
When it comes down to bang for your buck, gunpowder is about the most simple, efficient and compact way to hurl a small mass at high velocity and requires no electricity and basic mechanical parts.
Potentially better for the environment
The step from using explosives to fire bullets to rail/coilguns can already potentially be environmental saving. Depending on how the electricity was created/stored, it can quickly become more efficient than the explosive variant. This is because the explosives lose huge amounts of energy in heat and acceleration of things other than the bullet. With the rail/coilguns, this is much more efficient at at least the higher energies.
The choice for needles can be because of penetration. If the creatures have an armour that is strong enough and mitigates the energy of normal bullets to prevent internal damages, the bullet is nearly useless. They would need a lot of bullets on a part of the armour to penetrate.
The needles would penetrate, able to do internal damage. This is likely to be not incredibly dangerous to bigger creatures, unless very vital area's are hit. Even then the damage might not be enough right away to kill or incapacitate. It is still much more effective in these cases than bullets.
The recycling can make a lot of sense, but slightly different. You want your soldiers not to run out of ammunition. You can either have continuous supply lines and manufacturing, but if the soldiers could get the needles back from the battlefield, you can lower the amount of manufacturing and resources needed. This would also make them much more effective per round, as each can potentially be fired again. Thanks to the rail/coilgun giving the energy for the needle, you can easily reuse any needle. Possibly you just need to hammer it a little. Maybe you can even have the rail/coilguns on a setting to heat the metal (induction heating!), so it'll be malleable enough to work with. Or just melt it and let it solidify in needle form.
This way you have a potentially green powered machine of war that can fire and re-fire the ammunition. The choice of needles is out of necessity for consistent damage, as well as the easiest form to fire with the rail/coilguns. To make it your environmental argument, it will be certainly more environmental friendly than conventional guns, if you do the powering mechanism right. In addition, you reuse as much of your ammunition, which reduces manufacturing and supply lines, which also reduces the environmental impact. All you need is an as green as possible energy supply, a form of storage for this energy available to the guns and fix some problems the rail/coilguns still have at this stage.