In 1843 he published a book titled "The Conflict of Criticism with Church and State". This caused him to be charged with sedition. He was imprisoned for four years in the fortress at Magdeburg. While he was in prison, his former associates Marx and Engels published a scathing critique of him and his brother Bruno, titled "The Holy Family" (1844). They resumed the attack in "The German Ideology" (1846), which was not published at the time. In spite of this, Edgar Bauer seems to have remained on friendly terms with Marx and Engels. Released on the eve of the Revolution of 1848, Edgar Bauer participated in the revolutionary fighting in Berlin and Hamburg. After the defeat of the revolutionaries he went into hiding and then lived under an assumed name in Altona for several years, working as a journalist. During the German-Danish war over Schleswig-Holstein (1848–51), he supported the Danish side.