The magic square was first viewed as a talisman rather than as a form of recreational mathematics or an exhibition of rapid or miraculous calculation. The earliest record of a magic square (3 x 3) is found in China’s Da Dai Liji (1st century CE) and Shushu jiyi (possibly written by 190 BCE).
Simple magic squares, constructed with numbers or with playing cards began appearing as puzzles and amusements in conjuring texts by at least the 1500s. See, for example “Un giuoco de abaco bello” in Horacio Galasso’s Giochi di Carte Bellissimi di Regola, e di Memoria, 1593, and Lori Pieper's translation in Gibecière, Vol. 2 No. 2, Summer 2007, p. 65.
Over the past millennium, the size of magic squares and the methods for their construction have grown to a great diversity, filling whole books.