Your buyer made an offer, contingent on the well being brought up to code. The sellers rejected that contingency. That's totally within their right to do so.
You may be implying that the listing agent knew of a material defect. If so, yes, that should have been disclosed. But, come on. As the other Don notes, all sales are as-is sales. Your buyers were smart to have the inspections. (Though a home inspection is usually around $400. Sounds as if they had more done than that.) And by spending that amount of money, they avoided making a purchase that could have cost them tens of thousands of dollars in unexpected repairs.
But that's really why you have the home inspection. To find out what the problems are. As you know, after some home inspections, people simply terminate the contract. Your buyers went further and asked that a problem be corrected. That's fine. But it's equally acceptable for the sellers to say "no." (It may well have been a mistake on their parts. Look: They probably didn't have the money to do the repairs. Who knows?)
So you tell your buyers: "I know you feel like you wasted your money, but you didn't. That $1,208 probably saved you $10,000 or more. And it's a perfect demonstration of why I recommend--and you should always have--a home inspection. Now, let's take a look at what's available so that we can find you a home."
Issues found during inspections are then to be negotiated. Nothing says that sellers must agree to make repairs. Issues with septics and wells, oftentimes, are not even known by sellers. Even if a listing should state that it is an as-is sale does not mean that a buyers' agent cannot try to negotiate repairs if issues are discovered during inspections.
The monies your clients spent on the inspections is money very well spent - they now know more about the house and are able to make an educated decision. That is why we advise our buyer clients to have inspections.
Based on what you've written here, there appears to be nothing unethical. Not unless issues were known by the sellers and listing agent that were not disclosed.
It's very hard to say whether or not this was ethical or not. Unless you know what the owners specific instructions were, or can prove that the agent, or owner, knew there was a well issue, its a grey area at best. You might want to look at the Property Condition Disclosure to see what it says about the well or water problems. If it says No or Unknown, then its hard to question the agent's ethics.
The agent may have had no idea that the owner would refuse any repairs. Sometimes owners are not always honest with us until its decision time. If the owner accepted a contract with inspection contingencies, then technically it was not an 'as is' sale even if he/she was not willing to grant any repair concessions.
I think it is unfortunate for your buyer. If you talk to the agent for the next house they want to make an offer on, explain how they got burned, maybe you can get a sense for how resonable the owner is likely to be towards needed repairs.