Miller's play was written in 1953, at the height of the McCarthy era, when HUAC was investigating alleged communists in the entertainment industry. Miller himself was one of those investigated, and he used his play to express his concerns about the committee's tactics.
In both the Salem witch trials and the HUAC hearings, innocent people were accused of wrongdoing based on little or no evidence. In Salem, the accusers were often young girls who claimed to be possessed by the devil, while in the HUAC hearings, the accusers were often political enemies of the people they were accusing. In both cases, the accused were often denied due process and their lives were ruined.
Miller believed that the HUAC hearings were a dangerous threat to American democracy. He saw the committee as a kind of modern-day witch hunt, and he feared that it would lead to the persecution of innocent people. His play The Crucible was a way for him to warn the American public about the dangers of political persecution.