Even though the OP did a not particularly good job of wording what they were asking about, I do think this brings up two interesting ideas and questions.
Ok, let's say that they did have a way that a pregnant woman could get an injection and it would 100% guarantee that her kids would not be gay or trans, should she be ALLOWED to get it (note that I didn't say 'forced' or 'required')? I'm sure some people would say that such a procedure shouldn't be allowed at all, but to me, that begs the question: if we let a woman terminate her fetus on the basis of "it's her body so it's her choice", why would that same concept not apply here? If we let the pregnant woman decide whether the fetus lives or dies, how is that so much better than deciding what its sexuality will be?
2nd question, let's say that, instead of being injected into a pregnant woman, they actually did have an injection/procedure/whatever that would literally turn a gay person straight, or a trans person cis (or whatever the term is). Not "psychological reprogramming" or anything like that, but literally something that alters your genes (obviously this is sci-fi, but humor me), should people have the right to get it done if they choose to do so?