Add the following custom function in functions.php file of your theme to get the page url without the clean urls
function get_page_custom_link() {
global $post;
$link = '';
if ( 'page' == get_option( 'show_on_front' ) && $post->ID == get_option( 'page_on_front' ) )
$link = home_url("https://wordpress.stackexchange.com/");
else
$link = home_url( '?page_id=' . $post->ID );
return $link;
}
And call it in your template as following
<?php echo get_page_custom_link(); ?>
Note : It will not work for other urls( attachments, tags, taxonomy, post etc.)