Exhibit 5.1 March 30, 2006 MacroChem Corporation 110 Hartwell Avenue Lexington, Massachusetts 02421-3134 Re: Registration Statement on Form S-1 Ladies and Gentlemen: This opinion is furnished to you in connection with a registration statement on Form S-1 (the Registration Statement"), filed today with the Securities and Exchange Commission under the Securities Act of 1933, as amended, for the registration of shares of Common Stock, $.01 par value (the "Common Stock"), of MacroChem Corporation, a Delaware corporation (the "Company"), comprising (i) up to 7,861,900 shares of Common Stock issuable upon the conversion of the Company's Series C Cumulative Convertible Preferred Stock (the "Series C Preferred Stock") (plus an indeterminate number of additional shares of Common Stock as a result of antidilution provisions in the Certificate of Designation, Rights and Preferences of the Series C Preferred Stock (the "Certificate of Designation")) issued pursuant to the Purchase Agreement (as defined below) (such shares of Common Stock issuable upon conversion of the Series C Preferred Stock, the "Conversion Shares"), (ii) up to 4,953,001 shares of Common Stock which may be issued as payment of future dividends on the Series C Preferred Stock issued pursuant to the Purchase Agreement (such shares of Common Stock, the "Dividend Shares") and (iii) up to 8,648,101 shares of Common Stock issuable upon the exercise of the Warrants (plus an indeterminate number of additional shares of Common Stock as a result of antidilution provisions in the Warrants) listed below: A. Warrant No. 1 issued to SCO Capital Partners LLC on December 23, 2005 for the purchase of up to 1,904,761 shares of Common Stock. B. Warrant No. 2 issued to Lake End Capital LLC on December 23, 2005 for the purchase of up to 476,190 shares of Common Stock. C. Warrant No. 4 issued to SCO Capital Partners LLC on December 28, 2005 for the purchase of up to 142,857 shares of Common Stock. D. Warrant No. 5 issued to Lake End Capital LLC on December 28, 2005 for the purchase of up to 47,619 shares of Common Stock. E. Warrant No. 6 issued to Mark Alvino on December 28, 2005 for the purchase of up to 23,809 shares of Common Stock. F. Warrant No. 7 issued to Howard Fischer on December 28, 2005 for the purchase of up to 23,809 shares of Common Stock. G. Warrant No. 8 issued to Alpha Capital AG on February 13, 2006 for the purchase of up to 190,477 shares of Common Stock. H. Warrant No. 9 issued to BF Holding GmbH on February 13, 2006 for the purchase of up to 333,334 shares of Common Stock. I. Warrant No. 10 issued to Beach Capital LLC on February 13, 2006 for the purchase of up to 476,191 shares of Common Stock. J. Warrant No. 11 issued to Catalytix LDC Life Science Hedge AC on February 13, 2006 for the purchase of up to 47,620 shares of Common Stock. K. Warrant No. 12 issued to Catalytix LDC on February 13, 2006 for the purchase of up to 47,620 shares of Common Stock. L. Warrant No. 13 issued to Hudson Bay Fund LP on February 13, 2006 for the purchase of up to 95,239 shares of Common Stock. M. Warrant No. 14 issued to Iroquois Master Fund Ltd. on February 13, 2006 for the purchase of up to 333,334 shares of Common Stock. N. Warrant No. 15 issued to Midsouth Investors Fund LP on February 13, 2006 for the purchase of up to 285,715 shares of Common Stock. O. Warrant No. 16 issued to Perceptive Life Sciences Master Fund, Ltd. on February 13, 2006 for the purchase of up to 1,428,572 shares of Common Stock. P. Warrant No. 17 issued to Quogue Capital LLC on February 13, 2006 for the purchase of up to 238,096 shares of Common Stock. Q. Warrant No. 18 issued to SCO Capital Partners LLC on February 13, 2006 for the purchase of up to 952,381 shares of Common Stock. R. Warrant No. 19 issued to SDS Capital Group SPC, Ltd. on February 13, 2006 for the purchase of up to 238,096 shares of Common Stock. S. Warrant No. 20 issued to TMW Capital, LLC on February 13, 2006 for the purchase of up to 100,000 shares of Common Stock. T. Warrant No. 21 issued to Whalehaven Capital Fund Limited on February 13, 2006 for the purchase of up to 714,286 shares of Common Stock. U. Warrant No. 22 issued to SCO Capital Partners LLC on February 13, 2006 for the purchase of up to 328,856 shares of Common Stock. V. Warrant No. 23 issued to Lake End Capital LLC on February 13, 2006 for the purchase of up to 109,619 shares of Common Stock. W. Warrant No. 24 issued to Mark Alvino on February 13, 2006 for the purchase of up to 54,810 shares of Common Stock. X. Warrant No. 25 issued to Howard Fischer on February 13, 2006 for the purchase of up to 54,810 shares of Common Stock. The Warrants listed in paragraphs A through X above are referred to collectively herein as the "Warrants," and the shares of Common Stock issuable upon exercise of the Warrants are referred to herein as the "Warrant Shares." All share numbers included herein have been adjusted, where applicable, to give retroactive effect to the 1 for 7 reverse stock split of the Company's Common Stock effected on December 30, 2005 and the subsequent 1 for 6 reverse stock split of the Company's Common Stock effected on February 9, 2006. The Warrant Shares, together with the Conversion Shares and the Dividend Shares, are referred to collectively herein as the "Registrable Shares." The Company originally sold the Series C Preferred Stock and the Warrants pursuant to the Securities Purchase Agreement dated December 23, 2005, and amended and restated as of February 13, 2006, among the Company, Alpha Capital AG, Beach Capital LLC, BF Holding GmbH, Catalytix LDC, Catalytix LDC Life Science Hedge AC, Hudson Bay Fund LP, Iroquois Master Fund Ltd., Lake End Capital LLC, Midsouth Investor Fund LP, Perceptive Life Sciences Master Fund, Ltd., Quogue Capital LLC, SCO Capital Partners LLC, SDS Capital Group SPC, Ltd., TMW Capital, LLC and Whalehaven Capital Fund Limited (as amended, modified or supplemented from time to time, the "Purchase Agreement"). We understand the Registrable Shares are being registered to permit the resale of such Common Stock by the holders thereof from time to time after the effective date of the Registration Statement. We have acted as counsel for the Company in connection with its issuance and sale of the Series C Preferred Stock and Warrants. For purposes of this opinion, we have examined and relied upon such documents, records, certificates, and other instruments as we have deemed necessary. We have assumed that no issuance of the shares issuable upon conversion of the Series C Preferred Stock, as dividends on the Series C Preferred Stock or upon exercise of the Warrants will result in the issuance by the Company of shares in excess of its authorized Common Stock and that the price received by the Company for such shares upon exercise of the Warrants will not be less than the par value thereof. We express no opinion as to the applicability of, compliance with, or effect of federal law or the law of any jurisdiction other than the General Corporation Law of the State of Delaware. Based on the foregoing, we are of the opinion that: 1. The Conversion Shares have been duly authorized, and when issued out of the Company's duly authorized Common Stock upon conversion of, and pursuant to the provisions of, the Certificate of Designation, the Conversion Shares will be validly issued, fully paid, and non-assessable. 2. The Dividend Shares have been duly authorized, and when issued out of the Company's duly authorized Common Stock pursuant to the provisions of the Certificate of Designation, the Dividend Shares will be validly issued, fully paid and non-assessable. 3. The Warrant Shares have been duly authorized, and when issued out of the Company's duly authorized Common Stock upon exercise of, and pursuant to the provisions of, the Warrants and the Company having received the consideration therefor in accordance with the terms of the Warrants, the Warrant Shares will be validly issued, fully paid, and non-assessable. We hereby consent to your filing this opinion as an exhibit to the Registration Statement and to the use of our name therein and in the related prospectus under the caption "Legal Matters." It is understood that this opinion is to be used only in connection with the offer and sale of the Registrable Shares while the Registration Statement is in effect. Very truly yours, /s/ Ropes & Gray LLP Ropes & Gray LLP