EX-5.1 2 a2238621zex-5_1.htm EX-5.1
QuickLinks -- Click here to rapidly navigate through this document


Exhibit 5.1

GRAPHIC

        Allen & Overy LLP
        1221 Avenue of the Americas
        New York NY 10020
Target Hospitality Corp.        
2170 Buckthorne Place, Suite 440       Tel        212 610 6300
The Woodlands, TX 77380       Fax        212 610 6399

April 30, 2019

Ladies and Gentlemen:

        We have acted as counsel to Target Hospitality Corp., a Delaware corporation (the "Company"), in connection with the preparation and filing with the Securities and Exchange Commission (the "Commission") of the Company's Amendment No. 1 to the Registration Statement on Form S-3 (the "Registration Statement") under the Securities Act of 1933, as amended (the "Securities Act"), on the date hereof. The Registration Statement relates to the offer and sale from time to time by certain stockholders of the Company identified therein of an aggregate of 82,911,327 shares (the "Shares") of common stock of the Company, par value $0.0001 per share (the "Common Stock"). This opinion is being furnished in accordance with the requirements of Item 601(b)(5) of Regulation S-K under the Securities Act.

        In so acting, we have examined originals or copies (certified or otherwise identified to our satisfaction) of:

    i.
    the Registration Statement;

    ii.
    the Certificate of Incorporation of the Company filed as Exhibit 3.1 to the Registration Statement;

    iii.
    the By-laws of the Company filed as Exhibit 3.2 to the Registration Statement;

    iv.
    such corporate records, agreements, documents and other instruments, and such certificates or comparable documents of public officials and of officers and representatives of the Company, and have made such inquiries of such officers and representatives, as we have deemed relevant and necessary as a basis for the opinion hereinafter set forth.

        In such examination, we have assumed the genuineness of all signatures, the legal capacity and competency of all natural persons, the authenticity of all documents submitted to us as originals, the conformity to original documents of all documents submitted to us as certified, conformed or photostatic copies, and the authenticity of the originals of such latter documents.

        We have also assumed that (i) the Registration Statement and any amendments thereto will have become effective and comply with all applicable laws and no stop order suspending the Registration Statement's effectiveness will have been issued and remain in effect, in each case, at the time the Shares are offered and sold as contemplated by the Registration Statement and the applicable prospectus supplement and (ii) all Shares will be offered and sold in compliance with applicable federal and state securities laws and in the manner stated in the Registration Statement and the applicable prospectus supplement.

        Based on the foregoing, and subject to the qualifications, assumptions and limitations stated herein, we are of the opinion that the Shares have been validly issued and are fully paid and non-assessable.

        Our opinions expressed above are subject to the qualifications that we express no opinion as to the applicability of, compliance with, or effect of any laws except the General Corporation Law of the State of Delaware and the Federal laws of the United States of America.


        We hereby consent to the filing of this opinion with the Commission as Exhibit 5.1 to the Registration Statement. We also consent to the reference to our firm under the heading "Legal Matters" in the Registration Statement. In giving this consent, we do not hereby admit that we are in the category of persons whose consent is required under Section 7 of the Act or the rules and regulations of the Commission promulgated thereunder.

        The opinions set forth in this letter are effective as of the date hereof. We do not undertake to advise you of any changes in our opinion expressed herein resulting from matters that may arise after the date of this letter or that hereafter may be brought to our attention. We express no opinions other than as herein expressly set forth, and no opinion may be inferred or implied beyond that expressly stated herein.

        This opinion is given for the sole benefit of the persons to whom the opinion letter is addressed. This opinion letter may not be relied on by any other person without our prior written consent.

Very truly yours,

/s/ Allen & Overy LLP
Allen & Overy LLP

2




QuickLinks