Can one maintain one’s muscle strength even after they stop doing exercises?

That depends on your Genetics, how strong you were before you started exercising, what kind of exercises you were doing before you stopped doing them, your Nutrition, if you lead an Active or a Sedentary Lifestyle etc.

Assuming you got strong following a good Training Regimen (and eating healthy…), then, if you stop doing those exercises, then, you will need other ways to be active and compensate in other ways.

For example, if you were capable of Back Squatting 40 kilograms before you started Squatting. After training Squats properly, overtime now, you are able to Squat 100 Kilogram. Now, if you stop Squatting entirely (and do not workout at all), then, your ability to Squat 100 kgs will definitely go down over time.

That is unless you say do manual labor (or something similar) and find a way to lift heavy things, in places other than in the gym.

Same would be the case for instance, if you have undergone proper training to complete a Marathon. And then, you stopped training. You will of course, gradually have a reduction in speed and then, eventually, will not be able to complete running the entire distance.

One good news is that unlike Endurance / Conditioning (being able to run Marathons), which is relatively easier to obtain and likewise easier to lose, Strength takes a lot of effort to improve and does not go down as much or as quickly. Nevertheless, you definitely will not be able to maintain the same strength levels, if you stopped your training altogether, as discussed above. However, you will be able to quickly gain back your Strength levels, once you start training for Strength again.