Yep! They’re perfectly legal.  Most emulators are freeware, meaning you don’t have to pay to get them and giving a copy to your friend or family is perfectly safe. However, copying, distributing, downloading, and transferring ROM copies to play using an emulator is illegal.