England's General Teaching Council found Mark Goodwin, formerly of Moat House primary, Coventry, guilty of unacceptable professional conduct.
It heard he mixed with unsavoury characters and that more than two years ago he was arrested after police found a gun in his car, although they were satisfied he had no knowledge of it.
The GTC was told he was besotted with the prostitute and was trying to guide her away from a world of drugs and vice.
At one stage Mr Goodwin was stabbed but refused to report the incident to the police. Another time the prostitute's brother broke into his house looking for drugs.
Mr Goodwin revealed his association with the woman during a meeting almost three years ago to assess whether he could remain on Coventry's supply teacher register. An anonymous telephone call had raised Coventry council's concerns and Mr Goodwin said he would sell his house and dissociate himself from people from the drugs world.
But shortly after gaining a job at Moat House primary, in September, 2002, he was arrested after the gun was discovered in his car.
John Pierce, from Coventry city council's education service, said: "He was associated with unsavoury people who were taking advantage of him."
Mr Goodwin, who taught for 20 years, did not attend the hearing last week in Birmingham, nor was he represented.
MORE GTC rulings 11