What law did President Andrew Johnson violate that caused him to be impeached in 1868?
The Tenure Protection Act
The Republican majority in Congress had passed a law making it illegal for President Johnson to remove or replace any members his cabinet which he had inherited from President Lincoln.
The goal of this law was to protect the secretary of War Stanton who opposed Johnson's plans for the reconstruction of the south. The Republicans wanted to punish the south for the Civil War and to promote former slaves, in politics and business. Johnson who was from the south wanted a more humane approach to reconstruction.
President Johnson removed Stanton while Congress was out of session which was legal, but his temporary appointment of US Grant failed with Grants resignation and Sherman's refusal, to take the position. Johnson removed Stanton anyway in violation of the Tenure Act passed by Congress to protect Stanton.
The law that congress had passed and Johnson violated was clearly unconstitutional and Johnson had sought a test case before the Supreme Court. Johnson violated the law without a test case and so was impeached.
In reality the reason Johnson was impeached was not that he violated the law, but that he violated the will of Congress by attempting to soften the penalties facing the south because of the Civil War.