QuickLinks -- Click here to rapidly navigate through this document


Exhibit 5.1


Snell & Wilmer L.L.P.
600 Anton Boulevard
Suite 1400
Costa Mesa, California 92626-7689
TELEPHONE: (714) 427-7000
FACSIMILE: (714) 427-7799

September 19, 2006

Willdan Group, Inc.
2401 East Katella Avenue, Suite 300
Anaheim CA 92806

Ladies and Gentlemen:

        We have acted as counsel to Willdan Group, Inc., a Delaware corporation (the "Company"), relating to the proposed registration by the Company of up to 3,220,000 shares of the Company's common stock that may be sold by the Company and a selling security holder (the "Shares"), as described in the Registration Statement on Form S-1 filed by the Company on August 9, 2006 (the "Registration Statement") with the Securities and Exchange Commission (the "Commission") under the Securities Act of 1933, as amended (the "Act"), as amended by Pre-Effective Amendment No. 1 to Form S-1 filed on September 19, 2006 (the "Amendment"). In connection with this opinion, and as such counsel, we have examined and relied upon, originals or copies of the following documents (the "Documents"):

        For the purposes of rendering this opinion, we have examined originals or certified photo static copies of such other corporate records, agreements, instruments and other documents of the Company as we have deemed relevant and necessary as a basis for the opinion hereinafter set forth. In all such examinations, we have assumed the legal capacity of all natural persons, the genuineness of all signatures, the authenticity of original and certified documents and the conformity to original or certified documents of all copies submitted to us as conformed or reproduction copies. As to various questions of fact relevant to the opinions expressed herein, we have relied upon, and assume the accuracy of, certificates and oral or written statements and other information of or from representatives of the Company and others.

        Based on the foregoing, and subject to applicable state securities laws, we are of the opinion that the Shares have been duly authorized and, assuming certificates representing the previously issued Shares have been duly executed and delivered by the Company to the holders of such Shares, and upon payment for and delivery of those Shares subject to issuance and sale by the Company and the countersigning of the certificate or certificates representing such Shares by a duly authorized signatory of the registrar for the Company's Common Stock, the Shares will be validly issued, fully paid and non-assessable.



        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, applicable provisions of the Delaware Constitution and reported judicial decisions interpreting these laws. We assume no obligation to supplement this letter if any applicable laws change after the date of this letter with possible retroactive effect, or if any facts or events occur or come to our attention after the date of this letter that might change any of the opinions expressed above.

        We consent to the filing of this legal opinion as an exhibit to the Registration Statement, and we further consent to the use of our name under the headings "Legal Matters" in the prospectus that forms a part of the Registration Statement and "Legal Matters" in any prospectus supplement that will form a part of the Registration Statement. In giving such consent, we do not hereby concede that we are within the category of persons whose consent is required under Section 7 of the Securities Act or the Rules and Regulations of the SEC thereunder. This opinion is furnished by us, as counsel to the Company, in accordance with the requirements of Item 601(b)(5) of Regulation S-K under the Securities Act and, except as provided in this paragraph, is not to be used, circulated or quoted for any other purpose.




QuickLinks

Snell & Wilmer L.L.P. 600 Anton Boulevard Suite 1400 Costa Mesa, California 92626-7689 TELEPHONE: (714) 427-7000 FACSIMILE: (714) 427-7799