The Federal National Mortgage Association rebounded slightly from the worst quarter in its 12-year history as a private entity, reporting a third-quarter profit of $5.9 million (10 cents a share), FNMA said yesterday.

But the profit figure compares with a 1979 third-quarter profit of $45.3 million (74 cents) and gives the bank nine-month profits of $13.5 million (22 cents), compared with profits of $124.7 million ($2.06) for the same period last year.

Citing the high cost of borrowing earlier this year, the government-chartered lender, the nation's largest single investor in residential mortgages, reported a 1980 second-quarter loss of $16.5 million (27 cents) and a portfolio loss of $42.3 million. FNMA said yesterday that its third-quarter mortgage portfolio loss dropped to $12.7 million.

The profits improvement was the result of an increase in fee income from $9.6 million for the second quarter to $21.6 million for the third quarter this year. FNMA said that the increase in fee income was due to increased demand for commitments by mortgage sellers anticipating higher interest rates.

FNMA mortgage purchases declined during the quarter to $800 million, down from $1.8 billion reported for both this year's second quarter and the third quarter last year.

In another report, First Virginia Banks Inc. has reported a slight increase in third-quarter profits. Before securities gains and losses, First Virginia reported profits of $3.7 million (34 cents a share), up from third-quarter 1979 profits of $3.5 million (35 cents). The per-share profits decline was a result of an increase in outstanding preferred stock, the bank said.

For the first nine months of 1980, First Virginia, the McLean-based, 21-branch bank holding company, said profits were $10.7 million ($1.02), up from $10.6 million ($1.02) for the same period last year.

As of Sept. 30, First Virginia reported assets of $1.54 billion, up from $1.47 billion as of the same date in 1979. Deposits rose 7 percent to $1.4 billion at the end of the quarter, compared with the same date in 1979.