Rowley served as colonel of the 13th Pennsylvania Infantry from April 25, 1861, to August 6 of the same year. He then became colonel of the 102nd Pennsylvania Volunteer Infantry Regiment. He was wounded at the Battle of Seven Pines, while leading his regiment in the Army of the Potomac. He (briefly) led a brigade in VI Corps at the Battle of Fredericksburg. Promoted to the rank of brigadier general to rank from November 29, 1862, Rowley next commanded a brigade of I Corps at the Battle of Chancellorsville. He was acting commander of 3rd Division, I Corps at the beginning of the Battle of Gettysburg, while Maj. Gen. Abner Doubleday was acting corps commander. (Chapman Biddle led Rowley's brigade.) On July 1, 1863, the brigade suffered heavy casualties confronting Confederates from Maj. Gen. Harry Heth's division. He was thrown from his horse during the retreat when it stopped short at the creek. Sick with infection from boils the size of hens eggs on his inner thighs, he was feverish, and temperamental. Following a confrontation between Rowley and Brig. Gen. Lysander Cutler over the conduct of some of the 7th Wisconsin officers, Cutler filed charges of drunkenness in April 1864. Given less than 24 hours to prepare a defense for trial, Rowley was convicted by a court martial that author John F. Krumwiede states was, "lacking impartiality and marching to its own drum". Although reinstated by order of Secretary of War Edwin M. Stanton and President Abraham Lincoln, Rowley was assigned only a district command in western Pennsylvania, due to the ongoing feud between the army commander General George G. Meade and the now corps commander General Gouverneur K. Warren. Blocked by the actions of General Darius N. Couch in the attempt to stop the 1864 invasion of Pennsylvania by Confederate General Jubal Early, he resigned his commission on December 29, 1864.