Bajer was born on April 21, 1837 in Vester Egede, Denmark. He fought in the 1864 war against Prussia and Austria where he was promoted to the rank of first lieutenant. He was discharged in 1865, and moved to Copenhagen where he became a teacher, translator and writer.