If the captain/former captain of a merchant ship joined the navy or was press ganged into the the navy would they be put in command of a ship or would they have to work they way up through the ranks? I would appreciate any information or references on this topic as I have failed to find anything myself.
As has been remarked in the comments, the main impediment to a merchant captain gaining command of a Royal Navy vessel (and I'm assuming we're talking the English/British Royal Navy) is that he would have been at the back of a long line of candidates. At some points in the Age of Sail there were 7 times as many Post-captains as there were ships for them to command. The situation for Lieutenants (who served as Commanders of unrated vessels) was similar.
The press-gangs were out looking for able bodied men (not necessarily seamen) to provide the labour to work the ship and her guns. Typically up to 80% of a warship's crew would be there to operate the guns. While they would be found other work when not in battle, it only required a much smaller crew to simply sail the vessel. So they generally wouldn't be looking to press a more mature officer.
There were also rules for impressment that meant that most merchant captains couldn't be pressed anyway.
Merchant officers, for example — Masters, Chief Mates, Boatswains and Carpenters — could not be taken when at sea provided that their ships were of 50 tons burthen or over; nor could they be taken on land if, upon coming ashore, they hurried to a local Justice and swore to being what they professed.
A Social History of the Navy 1793-1815, pg.106
So any merchant captain that found themselves joining the RN at this time wouldn't simply walk into an commissioned officer's post. In order to pass for Lieutenant, a candidate had to have 6 years of service at sea, on a RN vessel, before they could take the examination (which a merchant captain would probably have the skills to pass). If they did so, they would then have to wait their turn for a posting like everyone else.
I suspect than anyone taking this route (unless exceptionally talented) would find themselves viewed as an outsider with little chance of advancement. Much of the movement of officers was the result of 'interest' - sometimes subtle and sometimes clearly nepotism - that was part and parcel of the service during the Age of Sail. Relationships that were created among junior officers and midshipmen, with their peers and seniors could often last for whole careers - so it's was as much who you know as what you know that got you advancement or a commission.
To address an additional question from the comments, if the whole ship was hired into the Navy (i.e. as a commissioned vessel) to supplement their warships, then generally the crew came along.
For this the Navy Board usually hired the vessel complete with master and crew, either for a specific period or indefinitely, for a regular month rate. The Admiralty supplied a regular naval officer (usually a Lieutenant) as commanding officer, while the civilian master habitually served under him as sailing master.
British Warships in the Age of Sail, 1714-1792, Rif Winfield (Seaforth 2007)
For clarity, it should be noted that the captain of a merchant ship was referred to as the ship's master rather than as the ship's captain to differentiate the role from that of a Post-captain. As noted, if the ship was hired into the Navy, the civilian master lost command to a RN commissioned officer.
Privateers, as the name suggests, were privately operated warships. These were never commissioned as part of the Royal Navy and, therefore, their masters and crew were never Navy personnel.
A Social History of British Naval Officers 1775-1815, Evan Wilson (Boydell, 2017)
A Social History of the Navy 1793-1815, Michael Lewis (Allen & Unwin, 1960)
The Wooden World, An Anatomy of the Georgian Navy, N.A.M Rodger (Collins, 1986)
This answer is about the Royal Navy, the most notable user of the press-gang. A merchant sea captain would not be qualified to command a warship. While he would be capable of sailing it, he would not be familiar with naval administration, etiquette, strategy or tactics.
If one joined the RN as a volunteer, he'd be given a post and rank that made use of his skills and experience. That would be Master's Mate or Sailing Master, and he might well be encouraged to take the examination for Lieutenant, which had to be passed to qualify for a commission as a naval officer.
A merchant captain would be unlikely to be pressed, because the ship-owner he worked for would promptly call in favours to get him released. Even if he was unemployed, he'd usually be considered a gentleman, and therefore not subject to the press under the class system of the time.
A pressed man would certainly never be put in charge of anything or given the chance to escape until he'd accepted naval service and was trusted.
No, I don't have sources, this is deduction. The situation has never come up for me in a great deal of reading about the history of the Royal Navy.