Ireland headed toward political risis today when results of this week's national election showed that no party was able to achieve a majority in Parliament and two seats were won by Provisional Irish Republican Army members imprisoned in British-ruled Northern Ireland.

Weeks of political maneuvering are expected before the fragmented new Parliament can choose a prime minister to form what is likely to be a shaky minority government that must confront the country's serious economic problems, including high inflation, increasing unemployment and a growing budget deficit and foreign debt.

With the election in border constituencies of the two IRA prisoners, the new government also is expected to come under pressure to take a more aggressive approach to relations with Britain and the problem of Northern Ireland. One of the elected prisoners, Kiernan Doherty, is in the 23d day of a hunger strike at Maze Prison outside Belfast demanding prisoner-of-war status for IRA convicts in Northern Ireland.

Seven other nationalist prisoners, three of them hunger strikers, also received surprisingly large numbers of votes as candidates in the Irish election, although they failed to win seats. Political analysts suggested today that the prisoners' strong showing in traditionally nationalist constituencies, along with the impact of economic issues nationwide, helped prevent the Fianna Fail party of Prime Minister Charles Haughey from maintaining a parliamentary majority.

As counting continued today under Ireland's complicated proportional representation system. Fianna Fail's share of the vote in Thursday's election stood at less than 46 percent, down from 51 percent four years ago. The party won 78 seats in the expanded 166-seat Irish Parliament.

The opposing Fine Gael won a record 35 percent of the vote and 65 seats, falling short of a majority even in combination with the other major opposition party, Labor, which obtained 15 seats. The upsurge of Fine Gael support was attributed to the party's promises of income-tax cuts, cash tax rebates for housewives and other measures to stimulate the economy.

In the previous Parliament, which was 18 seats smaller, Fianna Fail had 82 seats against 45 for Fine Gael and 16 for Labor. Haughey and Fine Gael leader Garret Fitzgerald announced today that each would try to form a government. This leaves the balance of power in the hands of a half-dozen independents who range from left-wing socialists to militant nationalists.

One of them Neil Blaney, a staunch nationalist who broke away from Fianna Fail, said he would vote with the party on economic issues but would give full support to Haughey only if Fianna Fail pledged an all-out diplomatic campaign for British withdrawal from Northern Ireland.

A Fine Gael-led government would require the support of the union-based Labor Party and left-wing independents. But many of the independents and some left-wing Labor members of Parliament object to Fine Gael's economic policies as benefiting primarily the middle class. Labor, which last joined a coalition government with Fine Gael from 1973 until 1977, will decide its strategy next week.

Supporters of the convicted Irish nationalist prisoners in Northern Ireland said the support by Irish voters for the prisoner candidates, particularly those on hunger strike, could help force the next Irish government to put greater pressure on British Prime Minister Margaret Thatcher to grant the prisoners' demands. Such pressure, they added, could lead to diplomatic intervention by other countries, including the United States.

"The lesson has come loud and clear from the Irish electorate that the policy adopted by the Haughey government [of only indirectly urging Thatcher to be more flexible] is the wrong policy," said Daithi O'Connail, director of the prisoners' election campaign.

O'Connail, who is also an official of Provisional Sinn Fein, the political wing of the Provisional IRA, said he also believed the showing of the prisoner candidates here and the election of hunger striker Bobby Sands to the British Parliament from a Northern Ireland constituency before his death on May 4 were signs of a "broadening" of the militant Irish nationalist movement on both sides of the border.

Persons who live in Northern Ireland can run as candidates because the Republic of Ireland's constitution extends citizenship to everyone on the entire island.

Nine prisoners, including four hunger strikers, were candidates in the election here. The largest vote for them was won in three rural constituencies along the border with Northern Ireland where nationalist sentiment is most prevalent.

Doherty, 25, who has been on hunger strike for 23 days and was moved to the prison hospital this week, was elected to a seat from Cavan-Monaghan on the border. His parents from Belfast campaigned for him. Arrested in 1976 in Belfast after a car chase and shootout with police, Doherty was sentenced to 22 years in prison for possession of explosives and guns and hijacking acar.

Patrick agnew, 26, a member of the Provisional IRA, who is serving 16 years on a weapons conviction, easily won election to a seat from the border constituency of Louth, where his home town of Dundalk is located. He won the largest number of first preference votes in the constituency.

Another hunger striker, Joseph McDonnell, who has gone without food for 36 days, came near winning election in Sligo-Leitrim, just across the border from Fermanagh district in Northern Ireland that elected Sands to the British Parliament. McDonnell, 30, is serving a 14-year sentence on an illegal weapons possession conviction.

Even if Agnew and Doherty were not in prison, they would not assume their seats in the Irish Parliament because members of the Provisional IRA and Sinn Fein refuse to take the required oath of allegiance. Their seats remain unfilled as long as they are alive or until the next election.

Imprisoned Irish nationalists, including hunger strikers, have won election to office in Ireland in the past. One of the most recent was John Joe McGirl, the current council chairman in the border county of Leitrim. He was elected to the Irish Parliament while in an Irish prison in 1957 and to the Leitrim council while in a British prison in 1973.