The Securities and Exchange Commission charged yesterday that a civilian contract officer for the Navy made an illegal profit by purchasing stock in a Texas company that he knew was about to receive a major contract.

In a lawsuit filed in U.S. District Court in Alexandria, the SEC said that Mark C. Saunders, a division director in the Naval Electronics Systems Command, made about $9,000 by taking advantage of "material nonpublic information" about a $58 million contract his staff had negotiated with Whitehall Industries Inc. of Dallas.

Government officials frequently have advance knowledge of contracts that are about to be awarded to civilian firms, but they are forbidden by law to capitalize on any information not publicly available to other investors.

Saunders, who lives in Crystal City, said the SEC complaint "came as a total shock to me." He declined to answer questions, and said he had turned the matter over to his attorney, Plato Cacheris.

According to the SEC's complaint, Saunders was the supervisory officer on the Navy's negotiations with Whitehall for a $58 million Navy electronic surveillance system known as SURTASS.

The SEC said that Saunders and a contract negotiator under his supervision traveled to Dallas in December, 1980, to wrap up the details of the proposed contract, which was awarded the following June.

For Whitehall, which had reported total sales of about $45 million in 1980, the receipt of a $48 million contract was a major business success, and just the announcement that it was under consideration more than doubled the value of Whitehall stock on the American Stock Exchange.

According to the SEC, Saunders anticipated that boom. The complaint said that on Jan. 23, 1981, shortly after his alleged visit to Dallas, Saunders bought 500 shares at 19 7/8 and sold them in May, after Whitehall had disclosed the negotiations, at 36 1/2. He later bought another 300 shares at 39 7/8 and resold them for 44 7/8, the SEC said, for a total gain of "approximately $9,000."

The SEC asked the court to order Saunders to "disgorge all illegally obtained profits resulting from his purchases of Whitehall securities" in those transactions.