The Virginia General Assembly early tonight concluded a hectic 46-day session that signaled a historic shift of power from once-dominant rural forces to the state's developing urban areas.

In a dramatic show of their clout, city and suburban legislators joined during the session to muscle through sweeping revisions in the state's complex highway formulas, funneling millions of dollars into Northern Virginia and other populous areas at the expense of rural counties.

But the 140 lawmakers left Richmond tonight frustrated, unable to resolve their differences over whether females under 18 years of age need permission from their parents or a judge for abortions and over who should fill a seat on the powerful three-member commission that regulates most businesses in the state.

Members of the House of Delegates, who will face elections this fall, insisted that the assembly impose some restraints on the ability of minors to obtain an abortion. But the Senate, which rejected a House bill requiring pregnant girls to obtain the permission of either a parent or a juvenile court judge for the procedure, balked. Conferees on the bill were unable to reach a compromise, and the issue died.

There was no resolution, either, of the question of who would win a seat on the State Corporation Commission, the quasi-judicial body that regulates banks, utilities, insurance companies and other businesses. The House and Senate deadlocked between state insurance commissioner James M. Thomson, a former Alexandria legislator, and Edward E. Lane, a former Richmond legislator, leaving the appointment to Gov. Charles S. Robb.

The sometimes fractious 1985 assembly gave the democratic governor most of what he wanted. The session, the last one over which Robb will preside as governor, saw legislators approve nearly $300 million in new spending for education, health, welfare, prison security and long-delayed state employe pay raises.

"It was a good, solid session with good, solid accomplishments," said Del. Warren G. Stambaugh (D-Arlington).

Robb thanked legislators tonight for supporting his proposals and added that they "displayed more statesmanship under considerable duress than could have been predicted" in resolving the highway funding issue.

Democrats, who control both houses of the assembly, moved today to defuse what promised to be a highly partisan issue over how the state's Republican legislators are excluded from the selection of state judges.

The Democrats voted not to fill the Richmond judgeship that Phoebe Hall, the wife of Democratic Del. Franklin P. Hall, was seeking. Many Republicans, who are excluded by the assembly's Democratic majority from playing a role in judicial nominations, were furious over the prospect of a legislator's family member winning the $55,000-a-year position, saying it smacked of back-room politics.

But almost 20 other hastily called conference committee meetings that were jammed into the final day resulted in compromises on measures disputed by the two chambers. Included was an interstate banking bill that will allow Virginia banks to merge with banks in other southeastern states. It should protect the state's banks from takeover by large New York-based banks, the bill's sponsor said today.

Legislators, pointing to what some officials said may be drastic cuts in federal aid, set aside $67 million for a reserve fund that also will be used as a hedge against any downturns in the state's booming economy.

Spurred by federal threats to withhold federal highway funds, legislators voted to raise the state's legal drinking age for beer from 19 to 21 over the next two years.

They enacted new protections for abused and runaway children and extended the rights of handicapped persons against discrimination in employment and housing.

Lawmakers approved a wide-ranging package of bills that would liberalize voter registration laws in the state, but the measures that cleared the assembly were much weaker than a citizens task force had recommended. The legislature approved efforts to encourage more registration sites, lengthen office hours and allow state and federal employes to serve as temporary registrars.

At the same time, the assembly again rejected efforts to pass a mandatory seat belt law, establish a state lottery or ban nonreturnable bottles and cans.

The hard-fought regional battle over the state's highway funding dominated much of the session. Urban and suburban coalitions, which in past years have disintegrated because of internal disagreements, solidly outflanked rural lawmakers.

"The rural areas are finally going to get what they deserve," said House Minority Leader Vincent F. Callahan Jr. (R-Fairfax). "They've been getting better than equal treatment; now they're going to get treated like everyone else."

"We've seen the clout here, and we're going to see it on other issues," said Sen. Edward M. Holland (D-Arlington).

Other urban legislators were more skeptical. "Coalitions come and go to meet particular needs and purposes," said Del. Richard M. Bagley (D-Hampton), chairman of the House Appropriations Committee. "They don't survive time."

One issue that threatens to tear apart the urban-suburban forces next year is the continuing controversy over the $21 million that the state funnels into the Metrorail system. Some influential city legislators who helped Northern Virginia fend off attacks on Metro funding this year warned that they may be less supportive in 1986 when Robb, a Northern Virginian and a Metro supporter, is not in the governor's office.

Even as they anticipated possible assaults next year on local projects, Northern Virginia officials spent the last week of this session gloating over their successes. They won millions more in state highway money, as well as new funding for Dulles International Airport, community colleges and other suburban Washington projects.

"It's the most productive session Northern Virginia has ever had," said Sen. Richard L. Saslaw (D-Fairfax).

This year's issues were debated against the backdrop of fall elections that include the House of Delegates and statewide offices for governor, lieutenant governor and attorney general, in which several legislators are involved.

A proposal to raise the state's 4-cent sales tax to 5 cents died early in this session, but many legislators said they expect efforts next year to raise the state's gasoline tax to finance a growing backlog of highway construction and maintence projects.

Some of the biggest winners in this year's budget were elementary and secondary schools and higher education. The legislature boosted the per-pupil aid to local governments from the current $1,605 to $1,901, an increase of $296 per student and $23 more than requested by Robb.

Robb and the assembly also compromised on his initial proposal to eliminate 600 jobs in the state's vast community college system, settling instead for about half that amount.

Most of the state's nearly 80,000 employes were scheduled to receive pay increases of more than 8 percent, with some employes, judges and constitutional officers receiving even more.