There are two short answers:
(1) For the most part, the courts have found them to be constitutional because a) they weren’t created with the intent of inflicting punishment and b) they are not punitive enough in effect to override the government’s “legitimate interests.” I would argue substantively that both of these contentions are false. It wouldn’t require a monumental effort. Generally, though, the registries are considered “civil, regulatory” measures. Except that practically no “real” regulatory, civil requirement is so intrusive or stringent while carrying the threat of lengthy imprisonment for even the most innocuous failures to comply (and these threats are routinely followed through on).
(2) They’re not, from a moral and truly objective standpoint, but it’s the courts that have the authority on the matter, so that’s that. Remember: the Supreme Court upheld the notion that slaves were not people, but property at one point. They gave the go-ahead to school segregation with their notorious “separate but equal” doctrine in Plessy v. Ferguson (1898).
Personally, I consider #2 to be a fair explanation for why the registration laws—particularly the most recent iterations of them, known variously as the Adam Walsh Act, SORA, SORNA, and so on—have been found constitutional. (To be clear, various jurisdictions have begun overturning pieces of these laws on ex post facto grounds as well as contract law principles in the case of plea agreements.)
It’s more complicated than this, of course. You have societal pressures broadly, you have judges who are elected in many jurisdictions and they’d rather stretch reason to its absolute limits before handing opponents a nice, fat, juicy focus of attack.