The Gallowgate was one of the poorer areas of Aberdeen and in the mid-19th Century consisted of a large area of slums. St Margaret's was founded in 1867 as a mission church by Father John Comper, one of the first followers in Scotland of the Oxford Movement. Comper was at the time rector of St John's, Aberdeen's oldest Anglican congregation. Comper felt that the poorer areas of Aberdeen were not being reached by the Church and felt obliged to respond, firstly in 1863 by founding St Margaret's Convent on the Spital and then the Gallowgate church.
The original church was a room rented by Comper on the Gallowgate. By 1870, a joint chapel-school had been consecrated and Comper had resigned from his post at St John's and become full-time priest to the newly formed St Margaret's. The architect was James Matthews (1819-1898). In 1879, a separate school was built followed by the St Nicholas chapel and rectory in 1898 and 1906 respectively, designed by Comper's son, Ninian Comper. A separate church hall was built in 1908.