History is limited because very large history files could make the shell slow! Shells are often used to recover from exceptional conditions (out of disk space, `rm -rf /`, etc) so it's important they be responsive no matter what.
bash's history limit is by default the last 500 commands, without considering duplicates. In practice this limit is easy to exceed, which is why bash config guides recommend upping it.
fish's history limit of 2^18 (~256k) commands is really more of a sanity check. Duplicate commands are counted only once, and commands are discarded by LRU (not oldest). This means history only starts being dropped after hundreds of thousands of unique commands. If you in fact run that many distinct commands, I'd love to hear more about your use case!