The basic answer is that Rav Moshe Feinstein (among others) forbade treating animals in this way. However, if someone violates the isur of tzaar baalei chaim, the animal itself does not "become nonkosher" or asur in any way. As a practical matter, certain animals (such as veal) do tend to be treifah because of the physical results of their mistreatment. However, that would not apply to eggs.
Specifically, the anwer to your two (different) questions would seem to be
It would be asur to treat the hens in a way that is defined as tzaar baailei chaim if eggs can be produced without such a method.
It would be a practical matter to discourage using such eggs in order to encourage proper behavior. However, (as with veal) the Rabbis did not issue an explicit takana against using such eggs.
Rabbi Jonathan Blass was asked this question in general and answered
22 Tevet 5763 Kosher Meat and Tzaar Baalei Chayim
Rabbi Jonathan Blass
If in the process of Shechita there is a violation of tzaar baalei
chayim, is it correct that the meat is treif?
Causing animals needless suffering is a serious offence (there is a
difference of opinion as to whether it is forbidden by the Torah or by
rabbinical edict). An animal that has suffered needlessly is not,
however, rendered non-kosher unless one of its organs was damaged in a
manner that would make it a treifa. Any suffering that is a necessary
part of the shechita is not “needless” and would not be included in
the prohibition against tzaar baalei chayim.
There are a number of sites that deal with the general halachos of this, but the above answer is the basic one that applies to your question. An example is given of veal in which the animal is raised under cruel conditions that lead to anemia. However, on a practical level, the cruelty will often lead to the animal used for veal (because it is so penned up and raised anemic) actually being a treifah because of lung lesions and other physical problems. Note that this applies to veal rather than chickens.
[Ask the Rabbi] (http://www.aish.com/atr/Eating_Veal.html)
The Aish Rabbi Replies:
There are different mitzvahs in the Torah which address different
issues. "Kosher" has to do with the species of animal, the way it is
slaughtered, and removal of the blood from the meat.
“Kosher" does not address the issue of conditions in which the animal
There is another mitzvah, however, which addresses your concern. "Tzar
Baalei Chaim" is the Torah prohibition against causing pain to
animals. And based on this, the great Rabbi Moshe Feinstein indeed
forbade raising animals in cramped and painful conditions.
One final note: Interestingly, animals which are raised in cramped
conditions and fed chemicals are frequently found to be NOT Kosher,
due to various problems and disease found in the organs of these
generations of bubbies have enlisted the same techniquesI assume you're being facetious, because that's not true; .25 kg of rich feed mix is pumped into a goose's stomach in a few seconds, damaging its stomach and causing an increase in mortality rate. I guess there are some rabbis willing to certify foie gras, but the process is cruel (more cruel than caging hens, IMO). Here's the Rashi you cited (Bava Basra 73b): "ליתן עליהם את הדין. שבחטאתם מתעכב משיח ויש להם צער בעלי חיים לאותן אווזים מחמת שומנן"