As a general rule, no.
Bayonets are sharp pointy things. If you have to do things at the muzzle of your weapon (like load the gun, for nearly all line infantry weapons in the Civil War) with them attached, you run the risk of stabbing yourself unless you slow down. As shooting people was the primary function of an infantryman in the 19th century, this mattered more unless assaulting a position.
Fortunately, there are a plethora of drill manuals from the Civil War available online with which to answer these questions. One compilation of both excerpts from and copies of these manuals is found at this reenacting site, http://www.zipcon.net/~silas/links.htm#N_5_
You can also look at these two links.
https://64thill.org/drillmanuals/index.htm
http://www.drillnet.net/1862/1862.htm
While the issue of long range accuracy was almost irrelevant on the black powder battlefield, with smokeless powder came the issue that a bayonet impeded accuracy by attaching an additional weight to the end of the rifle. When late 19th century rifles were sighted out to 1200 yards and more, that slight change in the weapon balance and barrel vibrations was enough to throw it off. Notably, the Russians calibrated their sights WITH the bayonet and originally presumed the bayonet would be kept on the rifle at all times. This is part of the reason the orignal models of the Mosin-Nagant developed a poor reputation for accuracy - people outside of Russia were shooting them without bayonet attached.