I’m worried that these bans could prevent more research from being
conducted. How can the efficacy of a treatment be studied if it can’t
be provided? Or are there research carve-outs?
Your concerns are real and legitimate and there are not exceptions for research in any of the statutes that I have reviewed (there are about two dozens of them and I haven't read them all).
These concerns are exactly that kind of Catch-22 issue came up with marijuana. Marijuana is classified in U.S. federal law as a Schedule I drug because it was considered to have no legitimate medicinal purpose, but its illegality barred all research except specific studies expressly authorized with federal legislation.
The concern isn't quite a strong in the case of transgender health care, because it is legal in roughly the same number of states where it is not legal (before considering legal challenges to the laws), and research results are being generated in places where it is legal.
This was not true of marijuana research in the early days, as it was illegal everywhere in the U.S. (and still is under federal law), and was illegal in many other countries that might do research as well (even in countries where it was tolerated, like the Netherlands).
Indeed, some of the strongest research evidence in support of transgender health care comes from countries other than the U.S. and U.S. states that have not enacted bans at this time. See, e.g., Maria Anna Theodora Catharina van der Loos, MD, Sabine Elisabeth Hannema, PhD, Daniel Tatting Klink, PhD, Prof Martin den Heijer, PhD, Chantal Maria Wiepjes, PhD, "Continuation of gender-affirming hormones in transgender people starting puberty suppression in adolescence: a cohort study in the Netherlands" The Lancet (October 20, 2022). DOI: https://doi.org/10.1016/S2352-4642(22)00254-1 (Some of the other relevant literature is cited here).
Pending Constitutional Litigation.
The constitutionality of transgender health care bans, under both state and federal constitutions, is also an active subject of litigation, which leaves the status of these laws partially undetermined. Some of this is summarized at the bottom of this answer, but the most important of these cases is the pair of cases, from Tennessee and Kentucky, which are pending before the U.S. Supreme Court.
The U.S. Supreme Court has agreed to consider a case from Tennessee in its next term that challenges that state’s gender-affirming care ban for young people. This concerns a Tennessee law that bans gender affirming hormone treatments for patients under the age of 18. The U.S. Court of Appeals for the 6th Circuit has kept bans of this type in place in Tennessee pending the U.S. Supreme Court appeal, after the Tennessee was blocked by a U.S. District Court judge who was reversed by the 6th Circuit on appeal because the 6th Circuit applied only a low rational basis test to the constitutionality of the law, relying upon Dobbs v. Jackson Women's Health Organization, 597 U.S. ____, the case in which the U.S. Supreme Court on June 24, 2022, reversed Roe v. Wade. The Septmeber 28, 2023 ruling of the 6th Circuit in the case (by a 2-1 vote), known as I.W. v. Skrmetti,can be found here (it also addresses a parallel case challenging a similar Kentucky statute).
The Statutes At Issue In The Upcoming SCOTUS Case
The statutes are summarized at one point in the court opinion as follows:
Tennessee’s and Kentucky’s statutes classify based on a minor’s sex as
assigned at birth. Tennessee prohibits medical procedures when sought
to “[e]nabl[e] a minor to identify with, or live as, a purported
identity inconsistent with the minor’s sex” or to “[t]reat[] purported
discomfort or distress from a discordance between the minor’s sex and
asserted identity.” Tenn. Code Ann. § 68-33-103(a). Kentucky
likewise prohibits procedures “for the purpose of attempting to alter
the appearance of, or to validate a minor’s perception of, the minor’s
sex, if that appearance or perception is inconsistent with the minor’s
sex.” Ky. Rev. Stat. § 311.372(2).
The full text of Tennessee statute states:
Section 68-33-103 - Prohibitions
(a) (1) A healthcare provider shall not knowingly perform or offer to
perform on a minor, or administer or offer to administer to a minor, a
medical procedure if the performance or administration of the
procedure is for the purpose of:
(A) Enabling a minor to identify with, or live as, a purported
identity inconsistent with the minor's sex; or
(B) Treating purported discomfort or distress from a discordance
between the minor's sex and asserted identity.
(2) Subdivision (a)(1) applies to medical procedures that are:
(A) Performed or administered in this state; or
(B) Performed or administered on a minor located in this state,
including via telehealth, as defined in § 63-1-155.
(b)(1) It is not a violation of subsection (a) if a healthcare
provider knowingly performs, or offers to perform, a medical procedure
on or administers, or offers to administer, a medical procedure to a
minor if:
(A) The performance or administration of the medical procedure is to
treat a minor's congenital defect, precocious puberty, disease, or
physical injury; or
(B) The performance or administration of the medical procedure on the
minor began prior to the effective date of this act and concludes on
or before March 31, 2024.
(2) For purposes of subdivision (b)(1)(A), "disease" does not include
gender dysphoria, gender identity disorder, gender incongruence, or
any mental condition, disorder, disability, or abnormality.
(3) For the exception in subdivision (b)(1)(B) to apply, the minor's
treating physician must certify in writing that, in the physician's
good-faith medical judgment, based upon the facts known to the
physician at the time, ending the medical procedure would be harmful
to the minor. The certification must include the findings supporting
the certification and must be made a part of the minor's medical
record.
(4) The exception in subdivision (b)(1)(B) does not allow a healthcare
provider to perform or administer a medical procedure that is
different from the medical procedure performed prior to the effective
date of this act when the sole purpose of the subsequent medical
procedure is to:
(A) Enable the minor to identify with, or live as, a purported
identity inconsistent with the minor's sex; or
(B) Treat purported discomfort or distress from a discordance between
the minor's sex and asserted identity.
(c)(1) It is not a defense to any legal liability incurred as the
result of a violation of this section that the minor, or a parent of
the minor, consented to the conduct that constituted the violation.
(2) This section supersedes any common law rule regarding a minor's
ability to consent to a medical procedure that is performed or
administered for the purpose of:
(A) Enabling the minor to identify with, or live as, a purported
identity inconsistent with the minor's sex; or
(B) Treating purported discomfort or distress from a discordance
between the minor's sex and asserted identity.
The full test of the Kentucky Statute is as follows:
311.372 Prohibition on treatments to a minor for purpose of attempting to alter the appearance or perception of the minor's sex --
Exceptions -- Penalties.
(1) As used in this section:
(a) "Minor" means any person under the age of eighteen (18) years; and
(b) "Sex" means the biological indication of male and female as
evidenced by sex chromosomes, naturally occurring sex hormones,
gonads, and nonambiguous internal and external genitalia present at
birth.
(2) Except as provided in subsection (3) of this section, a health
care provider shall not, for the purpose of attempting to alter the
appearance of, or to validate a minor's perception of, the minor’s
sex, if that appearance or perception is inconsistent with the minor's
sex, knowingly:
(a) Prescribe or administer any drug to delay or stop normal puberty;
(b) Prescribe or administer testosterone, estrogen, or progesterone,
in amounts greater than would normally be produced endogenously in a
healthy person of the same age and sex;
(c) Perform any sterilizing surgery, including castration,
hysterectomy, oophorectomy, orchiectomy, penectomy, and vasectomy;
(d) Perform any surgery that artificially constructs tissue having the
appearance of genitalia differing from the minor's sex, including
metoidioplasty, phalloplasty, and vaginoplasty; or
(e) Remove any healthy or non-diseased body part or tissue.
(3) The prohibitions of subsection (2) this section shall not limit or
restrict the provision of services to:
(a) A minor born with a medically verifiable disorder of sex
development, including external biological sex characteristics that
are irresolvably ambiguous;
(b) A minor diagnosed with a disorder of sexual development, if a
health care provider has determined, through genetic or biochemical
testing, that the minor does not have a sex chromosome structure, sex
steroid hormone production, or sex steroid hormone action, that is
normal for a biological male or biological female; or
(c) A minor needing treatment for an infection, injury, disease, or
disorder that has been caused or exacerbated by any action or
procedure prohibited by subsection (2) of this section.
(4) If a licensing or certifying agency for health care providers
finds, in accordance with each agency's disciplinary and hearing
process, that a health care provider who is licensed or certified by
the agency has violated subsection (2) of this section, the agency
shall revoke the health care provider's licensure or certification.
(5) Any civil action to recover damages for injury suffered as a
result of a violation of subsection (2) of this section may be
commenced before the later of:
(a) The date on which the person reaches the age of thirty (30) years;
or
(b) Within three (3) years from the time the person discovered or
reasonably should have discovered that the injury or damages were
caused by the violation.
(6) If a health care provider has initiated a course of treatment for
a minor that includes the prescription or administration of any drug
or hormone prohibited by subsection (2) of this section, and if the
health care provider determines and documents in the minor's medical
record that immediately terminating the minor's use of the drug or
hormone would cause harm to the minor, the health care provider may
institute a period during which the minor's use of the drug or hormone
is systematically reduced.
Effective: June 29, 2023
A review of the exact scope of each of these statutes is beyond the scope of a Law.SE answer, although some summaries and links to allow for further research can be found below. However, while most of these bans have "grandfather clauses" for people who are in the midst of receiving these treatments, I am not aware of any that have an express exception for medical research.
Other Laws
The current state of transgender health care bans is summarized on the following map:

(Source)
This map has a number of footnotes:
Notes (and see the "Citations" tab or click "Citations & More Information" below the map legend for more information about every
state):
-Arizona banned surgical care for transgender minors in 2022, but in 2023 a new governor issued an executive order with "shield" style
protections for transgender health care that is still legal in the
state. Go to the transgender healthcare "shield" Equality Map to learn
more about these laws.
-Multiple states have "grandfather" clauses, "weaning off" clauses, or limited exceptions for some transgender youth and/or for some types of
medication. Click "Citations" to read more detail about each bill or
to access the law's language directly.
Bans Permanently Blocked
The following laws are permanently blocked from being enforced, though
appeals may be ongoing. Transgender youth should still be able to
access care legally.
-Arkansas: In June 2023, a federal judge permanently blocked the state's 2021 ban, ruling it unconstitutional. However, the state has
said it will appeal the ruling, and the state also passed a new law in
2023 (effective 90 days after the legislature adjourns) that will
allow individuals who receive gender-affirming care as minors (or the
family members of those minors) to sue their medical providers for
malpractice, among other provisions. The 2023 permanent block builds
on an earlier temporary block issued in July 2021.
Bans Temporarily Blocked (In Full or In Part)
The following laws are at least partially blocked from being enforced,
though these court cases are still ongoing. Transgender youth should
still be able to access care legally to the extent each of these
blocks allow.
-Montana, fully blocked: In Sept 2023, a state district court temporarily blocked the state's ban on youth's care from being
enforced while the lawsuit continues.
Bans Not Yet in Effect
The following laws are not yet in effect. Transgender youth should
still be able to access care legally to the extent each of these
situations allow.
-New Hampshire: The state's ban will not go into effect until January 1, 2025.
Recommended citation:
Movement Advancement Project. [Year of access]. "Equality Maps: Bans
on Best Practice Medical Care for Transgender Youth."
https://www.mapresearch.org/equality-maps/healthcare/youth_medical_care_bans.
Accessed [September 24, 2024].
A July 3, 2024 story from National Public Radio generally corroborates the source above.
A report from April of 2024 with detailed statutory and case law citations can be found here.