On June 21, 2011, Kelly announced his retirement from the U.S. Navy and NASA, effective October 1, 2011. His retirement was announced on his Facebook page, where he wrote, "Words cannot convey my deep gratitude for the opportunities I have been given to serve our great nation. From the day I entered the United States Merchant Marine Academy in the summer of 1982 to the moment I landed the Space Shuttle Endeavour three weeks ago, it has been my privilege to advance the ideals that define the United States of America."
On April 29, 2011, the first launch attempt of STS-134 was scrubbed. Giffords traveled to Florida on her first trip since moving from Tucson to Houston in January after an attempted assassination. Her appearance at Kennedy Space Center gave the launch a high profile, "one of the most anticipated in years," according to The New York Times. President Obama visited the Kennedy Space Center on April 29 on a trip with the original intention of watching the Endeavour launch.
After his wife's shooting, Mark Kelly's status was unclear, but NASA announced on February 4, 2011, that he would remain commander of the mission. The remarkable progress his wife was making in her recovery helped Kelly decide to return to training. Peggy Whitson, chief of the NASA Astronaut Office at the time, said, "we are confident in his ability to successfully lead this mission, and I know I speak for all of NASA in saying 'welcome back.'"
At 4 pm PDT on May 22, 2011, the European Space Agency and Italian Space Agency arranged for a call to Endeavour by Pope Benedict XVI. During his call—prompted by the discovery of a gash in the Shuttle's fuselage—Benedict extended his blessing to Giffords, who had undergone skull surgery earlier in the week. The event marked the first time a pope spoke to astronauts during a mission.
On June 24, 2011, a recorded message by Kelly from the ISS wished his wife love using song lyrics from David Bowie's "Space Oddity" and introduced U2's song "Beautiful Day" on the first night of the Glastonbury festival in England. A similar message from Kelly aboard the ISS was played during U2's 360° Tour concert stop at various locations. It said: "I'm looking forward to coming home. Tell my wife I love her very much. She knows."
On June 21, 2011, Kelly announced that he would leave NASA's astronaut corps and the U.S. Navy effective October 1. He cited Giffords's needs during her recovery as a reason for his retirement.
In 2011, Kelly and Giffords coauthored Gabby: A Story of Courage, Love and Resilience. The book provides biographical information on the couple and describes in detail the assassination attempt on Giffords and her initial recovery. Written in Kelly's voice, it includes a short note by Giffords at the end.
Giffords was shot in an assassination attempt on January 8, 2011, putting Kelly in the national spotlight. On February 4, Kelly described the previous month as the hardest time of his life and expressed his gratitude for the enormous outpouring of support, good wishes and prayers for his wife. He said that he believed people's prayers for her helped.
A memorial service for those killed in the assassination attempt was held on January 12, 2011, at the University of Arizona. President Barack Obama flew to Tucson to speak at the memorial. Kelly sat between First Lady Michelle Obama and Secretary of Homeland Security Janet Napolitano, the previous governor of Arizona. At the end of the service, Obama consoled and embraced him, after which Kelly returned to the hospital to be with his wife.
Kelly spoke on February 3, 2011, at the National Prayer Breakfast in Washington, DC. His remarks closed the event, where Obama also spoke. Kelly said the attack on his wife brought him closer to God and gave him a newfound awareness regarding prayer. He said that before the attack, "I thought the world just spins and the clock just ticks and things happen for no particular reason", but that, in Tucson, as he found himself wandering in makeshift memorials and shrines filled with Bibles and angels, "You pray where you are. You pray when God is there in your heart." Kelly offered the final prayer of the morning. The prayer was from Rabbi Stephanie Aaron, who married Kelly and Giffords, and who said the same words over Giffords on the night of the shooting:
In 2011, Kelly said he believed there was a chance to change a political environment he believed was too vitriolic. He hoped that the tragedy would be an opportunity to improve the tone of the national dialogue and cool down the rhetoric. In response to a question on February 4, 2011, about civility in politics, Kelly said, "I haven't spent a lot of time following that, but I think that with something that was so horrible and so negative, and the fact that six people lost their lives including a nine-year-old girl, a federal judge, Gabby's staff member Gabe—who was like a younger brother to her—it's really, really a sad situation. I am hopeful that something positive can come out of it. I think that will happen, so those are good things."