It is through Calcifer's powers that Howl's castle is able to move. The fire demon will obey only Howl, though Sophie does manage to bully the demon on occasion to do her bidding, sometimes with disastrous results.
Calcifer is a fallen star who was caught by Howl. Calcifer didn't want to die, so he struck a deal with the wizard. Calcifer got Howl's heart and a prolonged life, and Howl received full access to all of Calcifer's considerable powers.
After a while, both Calcifer and Howl resent the contract, but it cannot be broken. When Sophie Hatter comes to Howl's moving castle, Calcifer recognizes that she is under a curse thanks to the Witch of Waste and that Sophie has considerable powers of her own of which she is unaware. To break his own curse, Calcifer offers to lift the curse placed on Sophie once she manages to break Calcifer's contract with Howl.
Unfortunately, neither Calcifer nor Howl could directly tell Sophie what the contract was and thus she must figure it out on her own. Sophie eventually discovers what the bargain is, uses her newfound magic to give Calcifer another 1000 years of life, and to return Howl's heart. Calcifer stays with Sophie and Howl in the castle, fulfilling much of the same duties as he did before, and he is able to come and go as he pleases. In Castle in the Air (1990), the semi-sequel to Howl's Moving Castle, Calcifer spends most of his time as a magic carpet that works best when flattered, until Howl says his name, returning him to his original state.