Irving Adler, a former New York City teacher who became a prolific writer of books on math and science for young people after being forced from the classroom during the Red Scare of the early 1950s, died on Saturday in Bennington, Vt. He was 99.

The cause was a stroke, his daughter Peggy Adler said.

Mr. Adler joined the American Communist Party in 1935, when he was 22. Sixteen years later, when he was chairman of the math department at Straubenmuller Textile High School on West 18th Street in Manhattan, he was subpoenaed to testify before a Senate subcommittee investigating Communist influence in the nation’s schools. He refused to answer the senators’ questions, citing his rights under the Fifth Amendment.

Within weeks, he was taken away from his students.

“I was teaching a class when the principal sent up a letter he had just received from the superintendent announcing my suspension, as of the close of day,” he recalled in 2009. He was later dismissed.

Mr. Adler was among more than 1,150 teachers who, in the anti-Communist furor of the cold war, were investigated under New York State’s Feinberg Law. Enacted in 1949, the law directed the Board of Regents to list organizations it considered subversive and deemed membership in those organizations prima facie evidence for firing any public school employee.