<Page> EXHIBIT 5.1 [Ice Miller letterhead] April 21, 2003 Board of Directors Bioanalytical Systems, Inc. 2701 Kent Avenue West Lafayette, Indiana 47906 Gentlemen: We have acted as counsel to Bioanalytical Systems, Inc., an Indiana corporation (the "Company"), in connection with the registration of 228,856 common shares (the "Shares"), covered by the Registration Statement (together with all amendments thereto, the "Registration Statement"), under the Securities Act of 1933, as amended (the "1933 Act") including the information statement/prospectus contained in the Registration Statement (as amended or supplemented, the "Prospectus") that the Company is filing in connection with the proposed merger of Pharmakinetics Laboratories, Inc., a Delaware corporation, into PI Acquisition Corp., a wholly owned subsidiary of the Company (the "Merger"). Unless otherwise defined herein, capitalized terms used shall have the meaning assigned to them in the Registration Statement. In connection therewith, we have investigated those questions of law we have deemed necessary or appropriate for purposes of this opinion. We have also examined originals, or copies certified or otherwise identified to our satisfaction, of those documents, corporate or other records, certificates and other papers that we deemed necessary to examine for the purpose of this opinion, including: 1. The Registration Statement, including the form of prospectus included therein, in the form in which has been filed with the Securities and Exchange Commission under the 1933 Act; 2. A copy of the Company's Restatement of Articles of Incorporation certified by the Secretary of State of Indiana on September 11, 2002 to be a true and correct copy thereof; 3. A copy of the Amended and Restated Bylaws of the Company, as amended to date; 4. Resolutions relating to the approval of the Merger and the approval of the issuance and registration of the Shares and the filing of the Registration Statement adopted by the Company's Board of Directors (collectively, the "Resolutions"); <Page> Board of Directors Bioanalytical Systems, Inc. April 21, 2003 Page 2 5. Such other documents and matters as we have deemed necessary or appropriate to express the opinion set forth in this letter, subject to the assumptions, limitations and qualifications stated herein. We have also relied, without investigation as to the accuracy thereof, on other certificates of and oral and written communication from public officials and officers of the Company. For purposes of this opinion, (i) we have assumed the authenticity of all documents submitted to us as originals and the conformity to authentic originals of all documents submitted to us as certified or photostatic copies; and (ii) we have relied upon a certificate from an officer of the Company stating that the Resolutions have not been amended, altered or superseded as of the date hereof. Based upon the foregoing and subject to the qualifications set forth in this letter, we are of the opinion that the Shares are duly authorized and, when issued and delivered in accordance with the resolutions of the Board of Directors authorizing their issuance and the terms of the Merger as summarized in the Prospectus, will be validly issued, fully paid and nonassessable. We consent to the use of this opinion as an exhibit to the Registration Statement, to the disclosure and summarization of the opinion in the Registration Statement, including in the Prospectus, and to the reference to our firm in the Registration Statement under the caption "Legal Matters." In giving this consent, we do not thereby admit that we come within the category of persons whose consent is required under Section 7 of the Securities Act of 1933, as amended, or the rules and regulations of the Securities and Exchange Commission promulgated thereunder. Very truly yours, /s/ ICE MILLER