Add variables to all permalinks in site

All permalink output has filters you can use to modify it: post_link, post_type_link, page_link, tag_link, category_link, term_link.

A simple example with page_link:

function wpd_append_query_string( $url, $id ) {
    // check some condition and add a query string var
    if( some_condition ) {
        $url = add_query_arg( 'var', 1, $url );
    }
    return $url;
}
add_filter( 'page_link', 'wpd_append_query_string', 10, 2 );