Mr. Krammer, a professor of history at Texas A&M University in College Station, Tex., said in an interview that he wrote the book with Mr. Gaertner after the German contacted him with regard to an earlier book Mr. Krammer had written, ''Nazi Prisoners of War in America.'' That book, published by Stein & Day in 1979, cited Mr. Gaertner as the last fugitive prisoner of war.

'Transition Into Legality'

It was in response to that, Mr. Krammer said, that Mr. Gaertner, still in hiding, called him from a telephone booth one night with a desire to tell his story. Mr. Krammer said he encouraged Mr. Gaertner to come forward as a way ''of easing his transition into legality'' and helping him ''come in from the cold.''

Mr. Krammer said there was ''no question'' that Mr. Gaertner's story was authentic. He said he had checked it by examining Mr. Gaertner's birth certificate, military records and other documents.

Officials said yesterday that it was unlikely that Mr. Gaertner would face Federal charges or deportation because of questions over which Federal statues, if any, might apply.

''We're not going to lock him up,'' said John Belluardo, a spokesman for the Immigration Service in San Pedro, Calif. He confirmed that Mr. Gaertner was the last known fugitive prisoner of war, calling him ''definitely unique from a historical standpoint.'' He said Mr. Gaertner's fate would be announced, in his presence, at a news conference by Harold Ezell, regional commissioner of the immigration service this morning in San Pedro.