Federal National Mortagage Association, a Washington corporation that is the nation's largest single investor in residential mortgages, yesterday reported a $16.5 million loss for the 1980 second quarter -- the first quarterly loss since it became a private enterprise 12 years ago.

The $16.5 million loss, equal to 27 cents a share, contrasts with a profit of $39.9 million (67 cents) for the second quarter of 1979.

FNMA said the second-quarter loss was caused by the high cost of short-term borrowing earlier this year, which the association said resulted in a $42.3 million loss on the corporation's mortgage and loan portfolio for the quarter. During the second quarter last year, the FNMA reported portfolio income of $56.2 million

"The results of the second quarter must be viewed against improvements in credit market conditions in recent months which have yet to be reflected in FNMA's earnings," said Oakley Hunter, the government-chartered company's chairman.

"The decline in interest rates since their peak in April has resulted in lower borrowing costs for the corporation while we continued to add relatively high yielding mortgages to our portfolio," Hunter said.

In virtually all financial categories, FNMA showed declines in the second quarter. The firm reported commitment fee income of $9.6 million for the quarter, compared with $15.2 million for the same quarter last year and $16.7 million for this year's first quarter. The cut in fee income reflects sagging demand by originating lenders, Fannie Mae said.

For the first six months of the year, FNMA reported a profit of $7.6 million (13 cents) compared with $79.4 million ($1.32) for the first six months of 1979,

Virginia National Bankshares Inc., of Norfolk, the parent holding company of Virginia National Bank, annonced a 16.8 percent increase in second-quarter profits before securities transactions. Virginia National reported profits of $5.878 million (85 cents), compared with $5.032 million (75 cents) for the second quarter of 1979.

For the first six months of the year, Virginia National said its profits were $11.979 million ($1.73) compared to $10.196 million ($1.51) for the first six months of 1979.

Virginia National's total assets rose to $2.552 billion as of June 30, compared with assets of $2.483 billion on the same date in 1979.