Congress yesterday approved and sent to the White House a compromise military pay bill providing raises of 10 to 17 percent for the 2 million men and women in the armed forces.

The raises, well over the 4.8 percent already given civilian government workers, are retroactive to Oct. 1, and should appear in paychecks Oct. 15 if President Reagan promptly signs the bill, as is expected.

The smallest raises, 10 percent, would go to recruits. The largest, 17 percent, would go to senior sergeants and petty officers. Officers would get an across-the-board 14.3 percent.

The bill, a product of negotiations between House and Senate conferees, also provides a 14.3 percent increase in housing and food allowances for all military personnel, and additional special-duty pay and bonuses for personnel in certain areas where there are manpower shortages.

It is a compromise between the House, which supported a flat 14.3 percent for all grades, and the Senate, which wanted to give the largest increases to experienced personnel to keep them in the services.

The $4.5 billion bill, a further increase in military spending at a time when social programs are being cut, has the support of the Reagan administration. It marks the second year in a row that military raises have far outstripped those given civilian government workers.

Last year, members of the armed forces received a 11.7 percent pay raise. Rep. Bill Nichols (D-Ala.) said yesterday that increase caused a "significant improvement in recruitment" and that the new one will "maintain this momentum."

The Senate approved the conference compromise unanimously by voice vote a few hours after it passed the House, 417 to 1. Rep. Adam Benjamin Jr. (D-Ind.), who contended that the military should not be exempt from budget cutbacks, cast the negative vote.

Examples of how the bill would affect pay at various ranks:

Army recruits, now paid $501 monthly, would get $551. Army corporals and Navy petty officers third class, now paid $756 monthly, would get $821. A sergeant first class with 18 years' experience, now paid $1,203 monthly, would get $1,408, and a sergeant major with over 26 years' experience, now paid $1,820 monthly, would get $2,130.

The 14.3 percent increase in office pay would raise the pay of a typical second lieutenant or ensign to $1,056 monthly; that of a captain or Navy lieutenant with six years' experience to $1,934 monthly; that of a major with 12 years' experience to $2,341 monthly, and that of a colonel or Navy captain with 20 years' experience to $3,354 monthly.

Other provisions include:

* An increase in flight pay from $306 to $400 a month for officers with more than six years' experience. This is designed to keep pilots in the services.

* A new travel and lodging allowance that provides for payment of expenses of up to $110 per day for soldiers, sailors and airmen transferred from one base to another.

* Increasing the maximum bonuses from $5,000 to $8,000 for four-year enlistments in certain critical areas.

* New $3,000-per-year bonuses for officers in certain scientific and engineering fields.

* Increases in hazardous duty pay, enlisted air crew flight pay and special pay for diving duty.

* Establishment of a new bonus pay system for weapons-control officers on Airborne Warning and Control System (AWACS) planes of from $125 to $350 per month. This is designed to correct a critical shortage in mid-level officers on AWACS planes.