Yes, ferrets and stoats are related. Both belong to the family Mustelidae, which includes weasels, badgers, otters, and wolverines.
More specifically, they are in the same genus, Mustela, making them close relatives. Ferrets are domesticated descendants of the European polecat, while stoats are wild animals.