
<PAGE>

                                                                     Exhibit 5.1


                                  May 12, 2000

ONEOK, Inc.
100 W. Fifth Street
P.O. Box 871
Tulsa, OK 74102-0871

     Re:  Up to $460,000,000 of Debt Securities
          and Common Stock of ONEOK, Inc.

Ladies and Gentlemen:

     We are acting as counsel to ONEOK, Inc., an Oklahoma corporation (the
"Company"), in connection with the authorization of the possible issuance and
sale from time to time by the Company of certain debt securities of the Company
("Debt Securities") and shares of Common Stock, par value $0.01 per share, of
the Company ("Common Stock"), in each case as contemplated by the Company's
Registration Statement on Form S-3, as it may be amended from time to time (the
"Registration Statement"). Except as otherwise defined herein, capitalized terms
that are defined in the Registration Statement are used herein as so defined.

     We have examined (a) the Registration Statement which is being filed with
the Securities and Exchange Commission, (b) the Certificate of Incorporation, as
amended, and the Bylaws, as amended, of the Company, (c) the corporate actions
taken by the Board of Directors of the Company in connection with the proposed
issuance and sale from time to time of the Debt Securities and Common Stock and
(d) such other corporation records, certificates of public officials and
officers of the Company and other documents, records and matters of law as we
have deemed necessary for purposes of this opinion. Based on such examination
and on the assumptions set forth below, we are of the opinion that:

          1.   The shares of Common Stock being registered pursuant to the
     Registration Statement, when issued and delivered as contemplated by the
     Registration Statement, and upon receipt by the Company of such lawful
     consideration therefor having a value of not less than the par value
     thereof as the Company's Board of Directors (or a duly authorized committee
     thereof) may determine, will be validly issued, fully paid and
     nonassessable.
<PAGE>

ONEOK, Inc.
May 12, 2000
Page 2

          2. The Debt Securities being registered pursuant to the Registration
     Statement when issued and delivered as contemplated by the Registration
     Statement and upon receipt by the Company of such lawful consideration
     therefor as the Company's Board of Directors (or a duly authorized
     committee thereof) may determine, will constitute valid and binding
     obligations of the Company.

     In rendering the foregoing opinion, we have assumed that (i) the
Registration Statement and any amendments thereto, will have become effective,
(ii) a Prospectus Supplement describing each class and/or series of Debt
Securities or Common Stock offered pursuant to the Registration Statement (the
"Offered Securities") will have been filed with the Securities and Exchange
Commission (the "Commission"), (iii) the definitive terms of each class and/or
series of Offered Securities will have been established in accordance with the
authorizing resolutions of the Company's Board of Directors, the Company's
Certificate of Incorporation, and applicable law, (iv) any Offered Securities
consisting of Common Stock will have been duly authorized and reserved for
issuance from the applicable class of capital stock of the Company, in each case
within the limits of such class of capital stock then remaining authorized but
unissued, (v) resolutions authorizing the Company to issue, offer, and sell the
Offered Securities will have been adopted by the Company's Board of Directors
and will be in full force and effect at all times at which the Offered
Securities are offered or sold by the Company and (vi) all Offered Securities
will be issued in compliance with applicable federal and state securities laws.

     With respect to any Offered Securities consisting of any series of Debt
Securities, we have further assumed that (i) an Indenture with respect to such
Debt Securities will have been duly executed and delivered by the Company and
the applicable Trustee in a form approved by us, and such Indenture will have
been qualified under the Trust Indenture Act of 1939, as amended, (ii) all terms
of such Debt Securities not provided for in the applicable Indenture will have
been established in accordance with the provision of the applicable Indenture
and reflected in appropriate documentation approved by us and, if applicable,
duly executed and delivered by the Company and the applicable Trustee, (iii)
such Debt Securities will be duly executed, authenticated, issued, and delivered
in accordance with the provisions of the applicable Indenture and (iv) the
interest rate on any such Debt Securities will not be higher than the maximum
lawful rate permitted from time to time under applicable law.

     In rendering the foregoing opinion, we have relied as to certain factual
matters upon certificates of officers of the Company, and we have not
independently checked or verified the accuracy of the statements contained
therein. In rendering the foregoing opinion, our examination of matters of law
has been limited to the laws of the State of Oklahoma and the federal laws of
the United States of America, as in effect on the date hereof.

     We understand that prior to offering for sale any Offered Securities you
will advise us in writing of the terms thereof, will afford us an opportunity to
review the operative documents
<PAGE>

ONEOK, Inc.
May 12, 2000
Page 3

(including the applicable Prospectus Supplement) pursuant to which such Offered
Securities are to be offered and issued, and will file as an exhibit to the
Registration Statement such supplement or amendment to this opinion (if any) as
we may reasonably consider necessary or appropriate by reason of the terms of
such Offered Securities or any changes in the Company's capital structure or
other pertinent circumstances.

     We hereby consent to the filing of this opinion as Exhibit 5.1 to the
Registration Statement and to the reference to us in the Prospectus under the
caption "Legal Matters."

                               Very truly yours,


                               John R. Barker
                               For the Firm
