You also need to check if the user is on that particular page or not. If he is on that page, then there is no need to redirect him/her again.
Change your else to this:
if(is_user_logged_in() && function_exists('pmpro_hasMembershipLevel') && pmpro_hasMembershipLevel()) {
global $current_user;
$current_user->membership_level = pmpro_getMembershipLevelForUser($current_user->ID);
echo 'Membership Level: ' . $current_user->membership_level->name;
} else {
if( ! is_page('page-slug') ){
wp_redirect('/my-account/orders/');
exit;
}
}
In which page-slug
is the slug of the page you are redirecting your users to.