They are used to look up the post. With a lot of systems... they generate a "slug" that is a unique URL to do a lookup for the actual ID/page/contents for that post.
But in a forum, the topic can change frequently. Instead of using the slug system -- we're just including the TopicID right in the url. Simpler, honestly 😉