To achieve this you have to mark the messages as Recoverable. By default, MSMQ messages are only held in memory, but Recoverable messages are backed to disk to enable reliable MSMQ Messaging.
Message recoverableMessage = new Message();
recoverableMessage.Body = "Sample Recoverable Message";
recoverableMessage.Recoverable = true;
MessageQueue msgQ = new MessageQueue(@".\$private\Orders");
Details can be found at the below link:-