pH-responsive magnetic nanocomposite hydrogels based on hydroxypropyl methylcellulose-g-poly(acrylamide)/LAPONITE® RD (HPMC-g-PAALap) were developed. The magnetic nanoparticles were synthesized inside HPMC-g-PAALap through an in situ method. The structure of the nanocomposite hydrogels was characterized using FTIR, XRD, SEM, TEM, and VSM techniques. The TEM micrograph revealed that the magnetite nanoparticles were immobilized onto the LAPONITE® RD surface. The FTIR of the magnetic nanocomposite showed that carboxylate groups are produced during magnetic nanoparticles formation in alkaline solution. The swelling capacities of the magnetic nanocomposites obtained were higher than that of non-magnetic hydrogel HPMC-g-PAALap, which was ascribed to the introduced carboxylate pendants. Due to the carboxylate groups, the magnetic nanocomposites indicated a pH-dependent swelling behaviour. Diclofenac sodium (DS) as a model drug was loaded in the nanocomposite hydrogels and the release of the drug was investigated with respect to pH of the media and also external alternative magnetic field. At pH 7.4, the content of the released drug was considerably increased as compared with that released at pH 1.2. The magnetic nanocomposite showed magnetic behaviour and the content of released drug was enhanced by increasing the strength of the external magnetic field.