In this paper we prove the Hardy inequalities for the quadratic form of the Laplacian with the Landau Hamiltonian magnetic field. Moreover, we obtain Poincaré type inequality and inequalities with more general families of weights, all with estimates for the remainder terms of these inequalities. Furthermore, we establish weighted Hardy inequalities for the quadratic form of the magnetic Baouendi-Grushin operator for the magnetic field of Aharonov-Bohm type. For these, we show refinements of the known Hardy inequalities for the Baouendi-Grushin operator involving radial derivatives in some of the variables. The corresponding uncertainty type principles are also obtained.2010 Mathematics Subject Classification. 26D10, 35P15.