A wireless body area network (WBAN) is constructed in the vicinity of a human body and provides various services for both medical and non-medical services. In order to provide monitoring services for medical devices, routing algorithms for wireless sensor networks (WSN) have been considered for WBANs. However, unlike WSNs, which consist of homogeneous devices, WBANs are organized with heterogeneous devices having different characteristics. Thus, directly applying routing algorithms for WSNs to WBANs is inefficient. This paper proposes a routing algorithm for WBANs. The proposed routing algorithm considers different communication costs for heterogeneous WBAN devices, and avoids faulty relay nodes for reliable transmission.