Is there any way to open a graphical program (for instance, gedit) while using X11 forwarding over SSH and transfer the X server connection back to the X server on the SSH host?
If you look at the Wikipedia page on the subject there are several apps mentioned.
xmove is a computer program that allows the movement of X Window System applications between different displays and the persistence of X applications across X server restarts. It solves a problem in the design of X, where an X client (an X application) is tied to the X server (X display) it was started on for its lifetime. Also, if the X server is shut down, the client application is forced to stop running.
xmove lets the client disconnect from its current X server, and connect to a new one, at any time. The transition is completely transparent to the client. xmove works by acting as a proxy between the client and server. It is a "pseudoserver" which stores enough server state so that clients can connect to a new server without being disrupted.
xpra or X Persistent Remote Applications is a tool which allows you to run X clients usually on a remote host and then direct their display to your local machine without losing any state.1
It differs from standard X forwarding in that it allows disconnection and reconnection without disrupting the forwarded application. It differs from VNC and similar remote display technologies in that xpra is rootless: i.e., applications forwarded by xpra appear on your desktop as normal windows managed by your window manager, rather than being all "trapped in a box together". Xpra also uses a custom protocol that is self-tuning and relatively latency-insensitive, and thus is usable over worse links than standard X.
guievict is a computer program which enables the GUI of any application for XFree86 implementation of X Window to be transparently migrated to or replicated on another display. Unlike some program providing similar functionalities, it requires neither prearranging steps such as re-linking the application program binary nor re-directing the application process's window system communication through a proxy like xmove does.
Guievict is based on a small X server extension that enables an application to retrieve its window state from the X server and a library of GUI migration functionality that is injected in the application process at run time. Code injection or runtime code-patching can be done via the DynInst API. However, guievict contains its own implementation to avoid requiring users to install DynInst.
Of the 3 of these, Guievict sounds like what you're looking for, mainly that it can checkpoint the state of X application AppX and migrate it to another X server where it can be restored.