This feature is already available. All the guest does is register an account using the same email address used when placing an order.
You could add a message to the order email letting customers know they should create an account to view order if they haven't already.