Neil Trotter admitted taking pictures of women at Edinburgh's Waverley Station and Glasgow's Buchanan Galleries between June and September 2014.
A sheriff told the 54-year-old, from Falkirk, that "women should be able to walk without fear" in public places.
He was also placed on the sex offenders register for 10 years.
A previous hearing at Edinburgh Sheriff Court was told that Trotter travelled into Edinburgh daily by train to go to work.
On Monday 29 September, a fellow passenger noted him walking in "a curious, a sinister manner" at Waverley Station, "clearly making an effort to get very close to a female ahead of him" on the escalator.
Fiscal depute Aidan Higgins, prosecuting, told the court that "it was clear he was using his phone to get under the lady's skirt, taking photographs".
The commuter reported his concerns to British Transport Police and Trotter was identified from CCTV footage. He was detained as he left the station the following day.
Examination of Trotter's phone and his home computer established that he had been using his mobile on various days between 11 June and 29 September, with 22 videos showing the camera had been directed under women's skirts.
Defence solicitor Neil Hay told the court Trotter was "most ashamed of his actions", and "well aware his behaviour is unacceptable".
He said his client had "lost his career, brought his family to the brink of financial ruin and brought shame and humiliation to himself and those very close to him".
Sentencing him to 18 months in prison, Sheriff Peter Braid told Trotter: "You have pled guilty to taking images of women in a clandestine manner, prompted by voyeuristic impulses for your own sexual gratification.
"This involved significant planning committed over a period of more than three months in public places where women should be able to walk without fear.
"The repugnance society must feel towards these offences is such that, in my view, there is no alternative to a custodial sentence, in retribution and to deter others."

A 24-hour walkout by members of the Rail, Maritime and Transport (RMT) union, in protest at the introduction of driver-only trains, ended at 11:00 BST on Wednesday.
Southern warned passengers to expect "difficult and frustrating" journeys throughout the day.
Two further strikes have been announced for 10 May and 12 May.
Latest updates here
The RMT confirmed it would attend talks with Southern "over the guards jobs and safety dispute" on Friday.
Dyan Crowther, chief operating officer for Southern owner Govia Thameslink Railway, told BBC Sussex: "We are very pleased to hear that and we look forward to meeting the RMT".
Southern said some routes were again suspended or reduced with 700 fewer services across Sussex and east Surrey.
Ms Crowther said the timetable would not return to normal until Thursday as they needed to get rolling stock and staff into the right position.
Paul Barker, a commuter from Rye, normally catches a Southern train to Ashford then a high-speed service to St Pancras.
He said he worked from home on Tuesday but went to Robertsbridge on Wednesday to catch a Southeastern service to London.
He said: "It was standing room only from Frant, but you cannot take two days off work".
RMT general secretary Mick Cash said: "This dispute is about safety. The company, with an eye on ever-fatter profits, is prepared to axe the guards on some of the most overcrowded and potentially-dangerous services."
The company said there would be no job or pay cuts but the planned changes would make conductors more visible while drivers would operate doors.
It accused the RMT of "scaremongering" and said "driver-only operation is a safe, proven way of working" which had been used "on 40% of trains across the Southern network for 25 years".
A former senior information officer for the Scottish government has been jailed for 18 months for using his mobile phone to take photos up women's skirts.
[NEXT_CONCEPT]
Talks to prevent a further strike by Southern rail conductors are to be held on Friday.