Frank Sinatra and Nancy Reagan introduced the first lady's new theme song, "To Love a Child," yesterday at the White House and Nancy Reagan was right on tune.

"She was great," said the song's lyricist Hal David, best known, perhaps, for "Raindrops Keep Falling on My Head," "What the World Needs Now" and "What Do You Get When You Fall in Love?," among others. "I said to Joe [Raposo, the song's composer], 'She'll get it. She rehearsed.' "

And Sinatra?

"Well," said David, "au naturel."

David and Raposo, whose credits include the Carpenters' hit "Sing" and "Sesame Street" tunes, shared a table in a balloon- and clown-filled big top on the South Lawn. Mrs. Reagan had invited them and 600 foster grandparents and children to a picnic lunch celebrating the publication of her new book about the Foster Grandparents Program, also titled "To Love a Child." Sinatra has recorded the song with the same title and the royalties from it and the book will benefit the program.

Yesterday, Mrs. Reagan's special guests were 28 foster grandparents from around the country whom she and her co-author, writer Jane Wilkie, have profiled in the book. Among them was an 80-year-old paroled convict, the first ex-convict to serve as a foster grandparent, who sat at her table.

Before the lunch of sandwiches, potato salad and brownies, Ogle Boyer of Columbus, Ohio, talked about the life sentence he was serving until he was paroled two years ago. He said he had been in prison 30 years -- "the last time." Before that, he had served a total of 28 years for grand larceny and armed robbery, offenses he said he committed during the Great Depression. That's what worries him about today, he said.

"If I got to talk to the president I'd tell him that with no employment and factories shutting down, people are going to commit crimes in order to live and feed their families," said Boyer, who was flown to Washington on a plane he said belonged to the governor of Ohio. Boyer regularly speaks to kids in that state about crime not paying.

"Almost two-thirds of the crimes people commit are because they ain't got no jobs," Boyer continued. "I don't know what the president can do, but I do know that when a man out there with a family of five or six kids robs a bank, you got to do something. That's the reason I went wrong. There wasn't no work in them days. It was bad, you know. That was the Hoover administration."

Sinatra flew in yesterday from Atlantic City where he starts an engagement tonight. He missed the Monday White House rehearsal with youngsters from the D.C. Public Schools City-Wide Chorus and 10-year-old Nikka Costa, who is also featured on the recording of "To Love a Child" with him.

Other guests included Mrs. Reagan's literary agent, Bill Adler, who told how he and the first lady first discussed the book about 18 months ago with the idea of benefiting Foster Grandparents.

"Very wholesome, very inspiring," said Grace Shaw, the publisher of Bobbs-Merrill, which has issued a first printing of 50,000.

Finding a collaborator for Mrs. Reagan fell to the White House, said Shaw, although the first lady's press secretary, Sheila Tate, said it was the publisher who found Wilkie of Fallbrook, Calif.

Others flying in for the picnic yesterday included Donald Crandall of Portland, Maine, a retired sea captain who is among 18,000 foster grandparents around the country working with 54,000 children. Crandall said he had been "flabbergasted" to get Nancy Reagan's invitation.

"Why wouldn't I be? I never amounted to very much. I was the captain of a small boat. But this is the top. If you come here you're at the top," said Crandall, 74.

Mrs. Reagan told her audience in thanking them for coming, "I really don't think these grounds have held so much tenderness and affection."