The Republican's held both the House and the Senate at the time and setup a trap for President Johnson to fire his Secretary of War which they claimed was unconstitutional.
He got Impeached by the house but remained in office by one vote.
From Archives:
When Johnson fired Secretary of War Edwin Stanton, an ally of the Radical Republicans, Stanton barricaded himself in his office, and an outraged House voted for impeachment. Eleven articles, or charges, were adopted and presented to the Senate, beginning the first Presidential impeachment trial.