Midshipman extraordinary originally referred to an officer in the Royal Navy below the rank of post captain who was paid as a midshipman until he could find another ship. Later it referred to a rating for graduates of the Royal Naval College in Portsmouth, who could not find a post as a midshipman.
Original usage 
A midshipman extraordinary, or midshipman extra, was an officer ranked master, lieutenant, or captain, whose ship had been paid off but who would be paid as a midshipman until he could find another ship. After half-pay was introduced for all officers in the early part of the 18th century, the term fell out of use.
Prior to 1816, graduates of the Royal Naval College were posted to ships as midshipman ordinary which was reserved for their use. Midshipman Extraordinary was revived in 1830s for graduates of the Royal Naval College who were not rated as a midshipman by their ship's captain. The Admiralty would appoint the volunteer Midshipman Extra and he would replace a seaman on board the ship. By 1842, midshipmen extraordinary were merged back into the ranks of midshipmen.