A grandmother who was sent to prison for refusing to see her family made homeless has been released after becoming a cause celebre and winning sympathy across Spain.