Violating a game's code of conduct is grounds for getting banned and this is no different for Fortnite. Epic Games can issue two kinds of bans, temporary and permanent. Temporary bans can be up to 30 days while permanents bans are forever.
If you find yourself getting either of these bans, you may be wondering if it is possible to get unbanned. The answer depends. According to the Epic Games help page, there is no official way to get unbanned or at least no mention of one. But this doesn't mean you should give up hope.
First and foremost, you can try and appeal the ban if you feel you were falsely banned. There is no guarantee that this will work and Epic's help page specifically says that permanent bans are indefinite. To submit an appeal, go to their contact page and send them a message. Be sure to include your Fortnite email, username, and a statement as to why you believe you should be unbanned.
There are bans that Epic will likely not overturn such as account bans, IP bans, or HWID bans. For account bans, there isn't much you can do besides creating a new account and starting over. While this sucks, you can still play Fortnite. If you find yourself on the wrong end of an IP ban, you can spoof your IP using a VPN. Not all VPN services will allow you to spoof your IP so it is best to do your research as most will require a paid subscription.
Lastly, for HWID bans you can try to spoof your HWID. This can be a severely complicated method and while there are Youtube tutorials available, it is not recommended. If you do something incorrectly, you run the risk of messing up your console or PC. Unfortunately, if you get an HWID ban, you will need a separate console or PC to play Fortnite again.
While it isn't possible to 100 percent avoid getting banned as sometimes accidents happen, you can minimize your chances. Avoid any kind of behavior that could be considered cheating or toxic, do not make wagers, avoid bullying, do not post inappropriate content, and do not have mod runners up even for other games as Fortnite may detect them.
For more information on Fortnite, check out Where to Find NPC #12 Scuba Jonesy in Fortnite Chapter 2 Season 8 and Where to Find NPC #11 Charlotte in Fortnite Chapter 2 Season 8 on Pro Game Guides.