I found the problem. This code was placed in a separate file that was added with a php include() function. And this include was happening before the Bootstrap files were loaded. So the Bootstrap JS file was not loaded yet, causing this modal to not do anything.
With the above code sample is nothing wrong and works as intended when placed in the body part of a html page.
<script type="text/javascript">
$('#memberModal').modal('show');
</script>