A magnetic coupler for attaching a mattress to a bed foundation includes a magnet assembly, a target assembly, and a shunt. The magnet assembly includes a housing and a magnet, wherein the housing is configured to couple the magnet to the mattress. The target assembly is configured to couple a target to the foundation. The shunt is disposed within the housing of the magnet assembly or in the mattress. The magnet assembly and the target assembly are releasably attached when the magnet is magnetically coupled to the target.