She may currently be behind bars, but Teen Mom's Amber Portwood is willing to do whatever it takes to maintain a relationship with her 3-year-old daughter, Leah.

Prior to being sentenced to a five-year prison term June 5 after opting out of a court-ordered rehab program, the troubled MTV reality star, 22, sought professional help at Seasons Recovery Center in Malibu, Calif. Entering treatment following a June 2011 suicide attempt, Portwood's time at Seasons is chronicled on her final season of Teen Mom.

On Tuesday's episode, Gary Shirley's ex receives a visit from Leah and her father -- but their reunion doesn't exactly go off without a hitch.

Traveling from his home in Indiana to California to meet up with Portwood, Shirley is shocked to find out that a court order bans him from being in the same room with his ex and daughter simultaneously. "I brought Leah with me but I guess we can't be together," he tells Portwood in an emotional sneak preview from Tuesday's show.

After a brief embrace, the couple part ways so Portwood can visit with her 3-year-old daughter. "This is where Mommy's been living for a while," Portwood tells the tot as the duo play outside on a swing set.

Despite her recent legal troubles, Portwood has vowed to keep up her relationship with Shirley and their little girl as much as possible while behind bars.

Says Portwood, who also vows to get her GED: "I'm not just going to sit [in prison]."

Teen Mom airs Tuesday at 10 p.m. (EST) on MTV.