The Crescent Stone by Matt Mikalatos (The Sunlit Lands #1)
When Madeline, a teen with terminal lung disease, accepts healing in exchange for a year of service in the Sunlit Lands, she and her friend Jason enjoy being privileged members of Elenil society, until they learn that magic carries a high price.