A system and method places a percutaneous gastrostomy device into a body cavity of a patient using a magnetic gastrostomy tube and a medical detection sensing device. The magnetic gastrostomy tube has a ferromagnetic element attached to its distal end. Various embodiments allow a needle to be passed from the magnetic detection sensing device outside the patient toward a magnetic gastrostomy tube inside the patient or, alternatively, from the magnetic gastrostomy tube inside the patient toward the magnetic detection sensing device outside the patient. After a needle makes a hole between the outside of the patient and the body cavity, a medical wire may be passed through the hole, and the medical wire can then be used to place the percutaneous gastrostomy device.