The specter of an aging population, retiring earlier but living longer, is hanging over the federal budget and creating stupendous pension and medical care obligations, Secretary of Health, Education and Welfare Joseph A. Califano Jr. told the Senate Committee on Aging yesterday.

Califano said that as the population continues to age there will be fewer and fewer active workers to pay for benefits for the elderly, and therein lies the problem. Today there are six working-age persons for each elderly person. In 50 years, the ratio will be three to one.

Califano told the committee that in 1940 the average life expectancy was 63 1/2 years, but today it is 69 for men and 77 for women. As a result of this change and a lower birthrate, the proportion of persons 65 or older has jumped from 7 percent to 11 percent and will be nearly 20 percent of the population by the year 2030.

"Ironically, while people are living longer they are retiring earlier," Califano said. "Thirty years ago nearly one-half of all men 65 and older remained in the workforce. Today, among people 65 and older only 1 man in 5 and 1 woman in 12 are in the workforce."

As a result, Califano said, the federal government is paying out $112 billion a year for persons 65 or older, which is nearly a quarter of the federal budget and 5 percent of the gross national product. By 2025 the government will be paying out $635 billion - 40 percent of the budget and 10 percent of GNP.

He said the government is also paying $19 billion a year to persons under 65 under various early retirement options.

The biggest chunk of these outlays come from Social Security, which at present is adequately funded, Califano said. But whether the various public and private pension systems will be able to handle the immense future outlays without drastic changes is unclear.

Califano said that excluding Social Security, pension plans for employes in private industry and for government employes cover many millions of persons, but "the integrity of employer pension plans is open to serious question." Unfunded liability of plans for federal, state and local employes and company pension plans "may well exceed the national debt of more than $600 billion."

Despite current outlays, about a quarter of the elderly are either poor or "near-poor" with incomes of about $5,200 for a married couple.

Califano suggested that one solution to the problem of a smaller work force paying for more retirees might be for people to stop retiring so early and to keep working longer, past 65 in many cases. "It makes little sense . . . for the skills and talents of millions of healthy older citizens to be wasted," he said, adding that a 1974 poll showed that 4 million persons 65 or older wanted to work but weren't.

One incentive, he said, would be pension "bonuses" for those who delay retirement - such as the just-voted 3 percent-a-year increase in Social Security benefits for each year a worker delays retirement after 65. Arrangements for part-time work for the elderly might be another, he said. Taxing the now tax-free Social Security benefits received by well-to-do persons is another possibility. He stopped short, however, of advocating a mandatory increase in the Social Security eligibility age.

In a step toward allowing persons to keep working beyond 65 if they desire, Congress earlier this year enacted a law forbidding employers from forcing employes to retire automatically at 65. At the earliest, employes in the private sector can be made to retire at the age of 70.